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.94.2) (envelope-from ) id 1sWIUR-00ELbA-IJ for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jul 2024 16:35:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sWIUP-00ElvW-3c for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jul 2024 16:35:49 +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.94.2) (envelope-from ) id 1sWIUO-00ElvO-Rd for pgsql-bugs@lists.postgresql.org; Tue, 23 Jul 2024 16:35:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWIUM-0013xh-Ra for pgsql-bugs@lists.postgresql.org; Tue, 23 Jul 2024 16:35:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 46NGZgIv1061675; Tue, 23 Jul 2024 12:35:42 -0400 From: Tom Lane To: exclusion@gmail.com cc: pgsql-bugs@lists.postgresql.org, Alvaro Herrera Subject: Re: BUG #18550: Cross-partition update of a former inheritance parent leads to an assertion failure In-reply-to: <18550-d5e047e9a897a889@postgresql.org> References: <18550-d5e047e9a897a889@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 23 Jul 2024 13:00:00 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1061673.1721752542.1@sss.pgh.pa.us> Date: Tue, 23 Jul 2024 12:35:42 -0400 Message-ID: <1061674.1721752542@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > The following script: > CREATE TABLE t1 (a int); > CREATE TABLE t2 () INHERITS (t1); > DROP TABLE t2; > CREATE TABLE t (a int) PARTITION BY LIST (a); > ALTER TABLE t ATTACH PARTITION t1 FOR VALUES IN (1); > INSERT INTO t1 VALUES (1); > UPDATE t1 SET a = 2 WHERE a = 1 > triggers an assertion failure (due to t1 is not recognized as a leaf > partition): > TRAP: failed Assert("rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE"), Hmm. Without the DROP TABLE, the ATTACH would fail: regression=# ALTER TABLE t ATTACH PARTITION t1 FOR VALUES IN (1); ERROR: cannot attach inheritance parent as partition I observe that in the case given, t1 still has pg_class.relhassubclass true after the ATTACH PARTITION. Maybe it'd be wise to force that false after verifying there are no subclasses? (I tried fixing it manually, and that prevents the assertion crash.) regards, tom lane