Re: Foreign key reference counting strategy?
| От | Markus Schaber |
|---|---|
| Тема | Re: Foreign key reference counting strategy? |
| Дата | |
| Msg-id | 4530EB84.4050904@logix-tt.com обсуждение исходный текст |
| Ответ на | Foreign key reference counting strategy? (Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>) |
| Ответы |
Re: Foreign key reference counting strategy?
|
| Список | pgsql-sql |
Hi, Joost, Joost Kraaijeveld wrote: > Is there a strategy to implement reference counting for foreign keys so > that if the last reference to the key is deleted, the record is deleted > also? Create an "after delete" trigger on the referencing table that checks whether there still are records with the same key (IF EXISTS()), and deletes the referenced row otherwise. It won't hurt to have an index on the referencing column, for speed reasons. HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in Europe! www.ffii.org www.nosoftwarepatents.org
В списке pgsql-sql по дате отправления: