pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org, Alvaro Herrera <alvherre@alvh.no-ip.org>
Subject: Re: BUG #18550: Cross-partition update of a former inheritance parent leads to an assertion failure
Date: Tue, 23 Jul 2024 12:35:42 -0400
Message-ID: <1061674.1721752542@sss.pgh.pa.us> (raw)
In-Reply-To: <18550-d5e047e9a897a889@postgresql.org>
References: <18550-d5e047e9a897a889@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> 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





view thread (5+ messages)  latest in thread

Message-ID: <1061674.1721752542@sss.pgh.pa.us>
Permalink:  ../1061674.1721752542@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1061674.1721752542@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, exclusion@gmail.com, alvherre@alvh.no-ip.org
  Subject: Re: BUG #18550: Cross-partition update of a former inheritance parent leads to an assertion failure
  In-Reply-To: <1061674.1721752542@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox