Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1woIRv-000xH5-2V for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Jul 2026 10:20:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1woIRu-00C5nK-0B for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Jul 2026 10:20:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wnWkt-00601I-2f for pgsql-bugs@lists.postgresql.org; Sat, 25 Jul 2026 07:25:07 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wnWkr-00000000FS9-1JBx for pgsql-bugs@lists.postgresql.org; Sat, 25 Jul 2026 07:25:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=WT4lbOCZ3al6BI69WbFefNxwaT5UWDyO2xo5JT0iZks=; b=O605d6GaP+h7ff0rmoPKThjmxs zvsZmx+vwfUjaH04Ss+NPA0RZgNWtFCk+8+CgeoT34+/Cvs+7AJMOEOVzluHp3knOj/45AG/ivoLK 73siD2aCRyOb7ouWwOPFXbtIZEX8b4fFsyfkHjj6K71ZFuCohDaFJ9YARX+LpNtxSep/Qlcdb7ehO lZI2f/Vc7P3DpgPLlsqJsvAoGTIQzUJ6HWSxGD63NtvtjrD/XUJgvWhXGnU/3diZNhoD0Yz4S3jAx +gSX2xLeLemjun/GwFJi010cFjxJClOJhOakQIjkobme8iwLn4HFW8M07KduXAcsSyCTc28V6C8/G 7G9Lm54A==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wnWkq-000oFU-2N for pgsql-bugs@lists.postgresql.org; Sat, 25 Jul 2026 07:25:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1wnWkp-00000001gm7-2R5U for pgsql-bugs@lists.postgresql.org; Sat, 25 Jul 2026 07:25:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19580: Can not FINALIZE detach partition. Table in stuck To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: o15611@gmail.com Reply-To: o15611@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sat, 25 Jul 2026 07:24:18 +0000 Message-ID: <19580-4baeeaaf5407a60d@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: =20 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;