Re: Foreign Key Constraint Deletion Order

Поиск
Список
Период
Сортировка
От
Тема Re: Foreign Key Constraint Deletion Order
Дата
Msg-id 200111200350.0341@lh00.opsion.fr
обсуждение исходный текст
Ответ на Foreign Key Constraint Deletion Order  (<cnliou@eurosport.com>)
Ответы Re: Foreign Key Constraint Deletion Order  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Foreign Key Constraint Deletion Order  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Thanks again! Stephan,

> I think you can do this as part of a trigger on
PurchaseMaster and
> something that doesn't do the subtraction if the
subselect returns
> a NULL in the detail trigger (or subtracts 0), not
as pretty, but
> it should function.  The master trigger would
subtract as necessary
> for the details for the user.

This is really a pain though it works.

Since delete from PurchaseMaster and PurchaseDetail
are both possible, two subtraction trigger functions
must be written for PurchaseMaster and
PurchaseDetail, respectively.

It also seems unwise not to use the
powerful-but-easy-to-use RI capability (on delete
cascade on update cascade) but to implement it with
my own trigger to be fired by PurchaseMaster.

If the delete was always done on PurchaseDetail
before PurchaseMaster, then one subtraction function
for PurchaseDetail along with the RI would settle
down everything.

Am I asking for too much, or RI and triggers were not
designed for operations like this example in the
first place?

CN

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com







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

Предыдущее
От: "Clayton Cottingham aka drfrog"
Дата:
Сообщение: Re: [OT?] permissions
Следующее
От: Roelof Sondaar
Дата:
Сообщение: How to use COPY in a function ?