Re: one to many

Поиск
Список
Период
Сортировка
От Dennis Gearon
Тема Re: one to many
Дата
Msg-id 40A7F21B.8070907@fireserve.net
обсуждение исходный текст
Ответ на Re: one to many  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Ответы Re: one to many  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
Stephan Szabo wrote:

>On Sun, 16 May 2004, Dennis Gearon wrote:
>
>
>
>>CC me please.
>>
>>How do I set up a one to many relationship in Postgres, (any DB for that
>>matter.)
>>
>>I.E., if a delete or update of a child table causes a row in the parent
>>table to no longer refer to any rows in the child table, to either cause
>>Postgres to error out or delete the parent? I can see it does it for
>>when a parent is upudated or deleted.
>>
>>
>
>I don't think there's any built in direct way to do this right now, but
>you could probably build triggers that would do it for you (the current
>foreign key triggers might give a starting point.  You'd probably also
>want to use CREATE CONSTRAINT TRIGGER to be able to defer the trigger
>(similarly to how the foreign key deferred works).
>
>
>
>
I didn't know you could set up triggers to be deferred! AWESOME! That
makes for some additional flexibility that I could use.

Thank you very much Stephen. I was beginnning to consider TRIGGERS as
the solution; Now I know that they will work.

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Upgrade from 7.3.4 to 7.4.2 went wrong
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: RTRIM always used with JDBC?