Re: Advice on foreign key and cascading delete design - postgresql 12.6
В списке pgsql-novice по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Advice on foreign key and cascading delete design - postgresql 12.6 |
| Дата | |
| Msg-id | 3190280.1618325238@sss.pgh.pa.us обсуждение |
| Ответ на | Advice on foreign key and cascading delete design - postgresql 12.6 ("Steve Tucknott (TuSol)" <steve@tusol.co.uk>) |
| Ответы |
Re: Advice on foreign key and cascading delete design - postgresql 12.6
|
| Список | pgsql-novice |
"Steve Tucknott (TuSol)" <steve@tusol.co.uk> writes:
> 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?
Maybe I'm missing something, but aren't you just looking for the
ON DELETE CASCADE option of foreign key constraints?
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера