agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: o15611@gmail.com
Subject: BUG #19580: Can not FINALIZE detach partition. Table in stuck
Date: Sat, 25 Jul 2026 07:24:18 +0000
Message-ID: <19580-4baeeaaf5407a60d@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 19580
Logged by: Oleg Ivanov
Email address: o15611@gmail.com
PostgreSQL version: 18.4
Operating system: Linux
Description:
drop table if exists t;
CREATE TABLE t (id bigint GENERATED BY DEFAULT AS IDENTITY, reg int, primary
key (id, reg)) PARTITION BY RANGE (id);
CREATE TABLE t1 PARTITION OF t FOR VALUES FROM (1) TO (20) PARTITION BY
RANGE(reg);
CREATE TABLE t11 PARTITION OF t1 FOR VALUES FROM (1) TO (10);
ALTER TABLE t DETACH PARTITION t1;
ALTER TABLE t ATTACH PARTITION t1 FOR VALUES FROM (1) TO (20);
"generated by default as identity" was added only to t1 and not in t11.
But, the problem is:
ALTER TABLE t DETACH PARTITION t1 CONCURRENTLY;
ERROR: column "id" of relation "t11" is not an identity column
I can not find a statement to FINALIZE detach:
ALTER TABLE t DETACH PARTITION t1;
ERROR: cannot detach partition "t1"
DETAIL: The partition is being detached concurrently or has an unfinished
detach.
HINT: Use ALTER TABLE ... DETACH PARTITION ... FINALIZE to complete the
pending detach operation.
ALTER TABLE t1 DETACH PARTITION t11;
ERROR: cannot alter partition "t1" with an incomplete detach
HINT: Use ALTER TABLE ... DETACH PARTITION ... FINALIZE to complete the
pending detach operation.
ALTER TABLE t11 ALTER COLUMN id ADD generated by default as identity;
ERROR: cannot add identity to a column of a partition
ALTER TABLE t1 ALTER COLUMN id drop identity;
ERROR: cannot alter partition "t1" with an incomplete detach
HINT: Use ALTER TABLE ... DETACH PARTITION ... FINALIZE to complete the
pending detach operation.
ALTER TABLE t11 ALTER COLUMN id drop identity;
ERROR: cannot drop identity from a column of a partition
ALTER TABLE t ALTER COLUMN id drop identity;
ALTER TABLE
ALTER TABLE t DETACH PARTITION t1 FINALIZE;
ERROR: column "id" of relation "t11" is not an identity column
Table in stuck.
The only way to FINALIZE is to drop section:
drop table t11;
ALTER TABLE t DETACH PARTITION t1 FINALIZE;
view thread (2+ messages) latest in thread
Message-ID: <19580-4baeeaaf5407a60d@postgresql.org>
Permalink: ../19580-4baeeaaf5407a60d@postgresql.org/
Also on: postgresql.org/message-id/19580-4baeeaaf5407a60d@postgresql.org
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: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, o15611@gmail.com
Subject: Re: BUG #19580: Can not FINALIZE detach partition. Table in stuck
In-Reply-To: <19580-4baeeaaf5407a60d@postgresql.org>
* 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