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

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2024-Jul-23, Tom Lane wrote:
>> 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.)

> Yeah, that seems to work.  We can do that essentially for free in
> StorePartitionBound(), like in the attached (which was taken in 14).

Looks sane.

> I'd add Alexander's script as a test too, somewhere near the bottom of
> create_table.sql.

Personally I'd include this in the existing alter_table.sql test case,
to save a few steps:

 -- check that the table being attached is not part of regular inheritance
 CREATE TABLE parent (LIKE list_parted);
 CREATE TABLE child () INHERITS (parent);
 ALTER TABLE list_parted ATTACH PARTITION child FOR VALUES IN (1);
 ERROR:  cannot attach inheritance child as partition
 ALTER TABLE list_parted ATTACH PARTITION parent FOR VALUES IN (1);
 ERROR:  cannot attach inheritance parent as partition
+DROP TABLE child;
+-- now it should work
+ALTER TABLE list_parted ATTACH PARTITION parent FOR VALUES IN (1);
+-- test insert/update, per bug #18550
+INSERT INTO parent ...
+UPDATE parent ...
 DROP TABLE parent CASCADE;

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <1080055.1721763503@sss.pgh.pa.us>
Permalink:  ../1080055.1721763503@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1080055.1721763503@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, alvherre@alvh.no-ip.org, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18550: Cross-partition update of a former inheritance parent leads to an assertion failure
  In-Reply-To: <1080055.1721763503@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