Re: Can not drop partition if exist foreign keys - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Can not drop partition if exist foreign keys
Date
Msg-id 202310111117.cdj4ngpfrppg@alvherre.pgsql
Whole thread Raw
In response to Can not drop partition if exist foreign keys  (Олег Самойлов <splarv@ya.ru>)
List pgsql-general
On 2023-Oct-11, Олег Самойлов wrote:

> There are two common practice to drop partition from partitioned
> table: just drop or detach-drop. But simple drop don't work if exist
> foreign key. Example script attached.

Yeah.  Detach it first, then you should be able to drop it.

> psql:test.sql:15: ERROR:  cannot drop table parent_0 because other objects depend on it
> DETAIL:  constraint children_id_fkey on table children depends on table parent_0
> HINT:  Use DROP ... CASCADE to drop the dependent objects too.
> 
> Looked like a bug.

We tried to make DROP work, but we didn't find a way.  Patches welcome.

-- 
Álvaro Herrera



pgsql-general by date:

Previous
From: Олег Самойлов
Date:
Subject: Can not drop partition if exist foreign keys
Next
From: Laurenz Albe
Date:
Subject: Re: Can not drop partition if exist foreign keys