Advice on foreign key and cascading delete design - postgresql 12.6 - Mailing list pgsql-novice

From Steve Tucknott (TuSol)
Subject Advice on foreign key and cascading delete design - postgresql 12.6
Date
Msg-id c1cfdf4054e8480d28fbf7fb2e15912d3996ee69.camel@tusol.co.uk
Whole thread Raw
Responses Re: Advice on foreign key and cascading delete design - postgresql 12.6  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Simon Connah
Date:
Subject: Can't work out what is wrong with this code
Next
From: Tom Lane
Date:
Subject: Re: Advice on foreign key and cascading delete design - postgresql 12.6