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