From: Олег Самойлов <splarv@ya.ru>
To: Laurenz Albe <laurenz.albe@cybertec.at>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Can not drop partition if exist foreign keys
Date: Thu, 12 Oct 2023 17:56:10 +0300
Message-ID: <1113211697122316@mail.yandex.ru> (raw)
In-Reply-To: <4734b034a623e8fa9d7522e4b4b7995cd1f3728f.camel@cybertec.at>
References: <5E197F1B-BDDF-40AF-9D87-D6792CE1A3B9@ya.ru>
<4734b034a623e8fa9d7522e4b4b7995cd1f3728f.camel@cybertec.at>
<div> </div><div> </div><div>11.10.2023, 14:20, "Laurenz Albe" <laurenz.albe@cybertec.at>:</div><blockquote><p>On Wed, 2023-10-11 at 14:08 +0300, Олег Самойлов wrote:</p><blockquote> There are two common practice to drop partition from partitioned table: just drop or detach-drop.<br /> But simple drop don't work if exist foreign key. Example script attached.</blockquote><p><br />That is working as designed. You cannot detach a partition of a table if a<br />foreign key points to it.</p></blockquote><div>Nope, of cause any can <span style="background-color:transparent">detach a partition of a empty table even if a foreign key points to it.</span></div><div>The problem is other. Documented that there are two variants how drop partition. Just drop or detach then drop. Both work on a simple partition, but only the second variant works in this case.</div>
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: splarv@ya.ru, laurenz.albe@cybertec.at
Subject: Re: Can not drop partition if exist foreign keys
In-Reply-To: <1113211697122316@mail.yandex.ru>
References: <5E197F1B-BDDF-40AF-9D87-D6792CE1A3B9@ya.ru> <4734b034a623e8fa9d7522e4b4b7995cd1f3728f.camel@cybertec.at> <1113211697122316@mail.yandex.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox