Re: BUG #16276: Server crash on an invalid attempt to attach a partition to an index

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2020-02-26T08:06:24Z
Lists: pgsql-bugs
On Tue, Feb 25, 2020 at 04:00:01PM +0000, PG Bug reporting form wrote:
> The following query:
> create table idxpart(a int) partition by list (a);
> create index idxpart_idx on idxpart (a);
> create table idxpart1(a int);
> alter table idxpart_idx attach partition idxpart1 for values in (0);
> 
> leads to a server crash with the following stack trace:
> Core was generated by `postgres: law regression [local] ALTER TABLE         

Attempting to attach a table to a partitioned index?  Nice thought.
Without the assertion, RangeVarCallbackForAttachIndex complains that
the relation is not an index, which is right, so I would be tempted to
just remove the culprit assertion.  Any thoughts?
--
Michael

Commits

  1. Fix assertion failure with ALTER TABLE ATTACH PARTITION and indexes