Advice on foreign key and cascading delete design - postgresql 12.6

Поиск
Список
Период
Сортировка
От Steve Tucknott (TuSol)
Тема Advice on foreign key and cascading delete design - postgresql 12.6
Дата
Msg-id c1cfdf4054e8480d28fbf7fb2e15912d3996ee69.camel@tusol.co.uk
обсуждение исходный текст
Ответы Re: Advice on foreign key and cascading delete design - postgresql 12.6  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
I have a few tables that are subservient to multiple other tables (notes, addresses, attached documents etc).
These tables carry the 'owning' table name and its record's PK.

I can manually keep these tables tidy and avoid orphans, but is there a way within postgresql to reference these tables on a FK constraint to automatically delete the subservient recs when the parent is deleted?

OR have I got the structure all wrong anyway and is there a cleaner way of holding, say notes, for records on a whole range of tables?

Thanks all.

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

Предыдущее
От: Simon Connah
Дата:
Сообщение: Can't work out what is wrong with this code
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Advice on foreign key and cascading delete design - postgresql 12.6