Re: PostgreSQL: Question about rules

Поиск
Список
Период
Сортировка
От Jeremy Smith
Тема Re: PostgreSQL: Question about rules
Дата
Msg-id 7353a39e0611161525o517c7a42i247ddd1b273cc649@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL: Question about rules  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: PostgreSQL: Question about rules
Список pgsql-general
On 11/16/06, Jeff Davis <pgsql@j-davis.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: PostgreSQL: Question about rules
Следующее
От: "Jeremy Smith"
Дата:
Сообщение: Re: PostgreSQL: Question about rules