Re: Advice on foreign key and cascading delete design - postgresql 12.6

Поиск
Список
Период
Сортировка
От 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  ("Steve Tucknott (TuSol)" <steve@tusol.co.uk>)
Список 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 по дате отправления:

Предыдущее
От: "Steve Tucknott (TuSol)"
Дата:
Сообщение: Advice on foreign key and cascading delete design - postgresql 12.6
Следующее
От: "Steve Tucknott (TuSol)"
Дата:
Сообщение: Re: Advice on foreign key and cascading delete design - postgresql 12.6