public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Bolaji Wahab <[email protected]>
Cc: [email protected]
Subject: Re: Clarification of behaviour when dropping partitions
Date: Thu, 05 Dec 2024 02:38:34 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+f_mLO=qNkHCumSfbcLz7Fb7DBoByNLLby3NDUod_TuHn1ZeA@mail.gmail.com>
References: <CA+f_mLPhCa_G3nRrB4=e3trqCSQ88x56ZvfeweH-AhwS77xEGg@mail.gmail.com>
	<[email protected]>
	<CA+f_mLO=qNkHCumSfbcLz7Fb7DBoByNLLby3NDUod_TuHn1ZeA@mail.gmail.com>

On Wed, 2024-12-04 at 23:00 +0100, Bolaji Wahab wrote:
> On Wed, Dec 4, 2024 at 6:20 PM Laurenz Albe <[email protected]> wrote:
> > On Wed, 2024-12-04 at 14:22 +0100, Bolaji Wahab wrote:
> > > I have these two partitioned tables, with referential integrity. The tables
> > > are structured in such a way that we have 1 to 1 mapping between their
> > > partitions. This is achieved with a foreign key.
> > 
> > I recommend that you don't create the foreign key constraint between the
> > partitioned tables, but between the individual partitions.
> > 
> > That will make detaching and dropping partitions easier, and you will have
> > the same integrity guarantees.
> 
> Yes, this is what I have done.
> But the whole point of declaring the foreign key constraint on the partitioned
> table is to have it automatically created on subsequent/future partitions.

Sure, but then you have to accept the disadvantage that it becomes more
difficult to detach partitions.  I think it is less pain to create the
constraint on the partition level.

Yours,
Laurenz Albe






view thread (3+ 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], [email protected]
  Subject: Re: Clarification of behaviour when dropping partitions
  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