public inbox for [email protected]  
help / color / mirror / Atom feed
From: Steve Tucknott (TuSol) <[email protected]>
To: PostGreSQL <[email protected]>
Subject: Advice on foreign key and cascading delete design - postgresql 12.6
Date: Tue, 13 Apr 2021 13:40:51 +0100
Message-ID: <[email protected]> (raw)

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.


view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Advice on foreign key and cascading delete design - postgresql 12.6
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox