Search Postgresql Archives

Re: PostgreSQL: Question about rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/16/06, Jeff Davis <pgsql@xxxxxxxxxxx> wrote:

create rule "child_with_parent_explicit_insert" as
        on insert to child_with_parent_explicit do instead (
                insert into parent(id, foo) values(COALESCE
(new.id ,NEXTVAL('parent_id_seq')), new.foo);
                insert into child(id, bar) values(COALESCE
(new.id,CURRVAL('parent_id_seq')), new.bar);
        );


I'm not sure if this is what you're looking for, but does this help?

Regards,
        Jeff Davis


COALESCE is certainly something I had never heard of.  I think that will solve my problem quite effectively.  Thanks for your help!

Jeremy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux