Re: Can not drop partition if exist foreign keys

From: Олег Самойлов <splarv(at)ya(dot)ru>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-generallists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Can not drop partition if exist foreign keys
Date: 2023-10-12 14:56:10
Message-ID: 1113211697122316@mail.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<div> </div><div> </div><div>11.10.2023, 14:20, "Laurenz Albe" &lt;laurenz(dot)albe(at)cybertec(dot)at&gt;:</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>

Attachment Content-Type Size
unknown_filename text/html 888 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Олег Самойлов 2023-10-12 15:07:31 Re: Postgresql HA cluster
Previous Message Dominique Devienne 2023-10-12 14:49:50 Re: List users privileges for whole cluster/all databases in the cluster