Re: BUG #17997: Assert failed in validatePartitionedIndex() when attaching partition index to child of valid index

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-06-25T14:40:58Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> The following script:
> create table t(a int) partition by range (a);
> create index on t(a);
> create table tp1(a int) partition by range (a);
> create table tp1_1 partition of tp1 for values from (1) to (10);
> create index on only tp1(a);
> alter table t attach partition tp1 for values from (1) to (100);
> create index on tp1_1(a);
> \d+ t
> \d+ tp1
> alter index tp1_a_idx attach partition tp1_1_a_idx;
> ... triggers an assertion failure with the following stack trace:

> #5  0x000055b6a19eb40f in ExceptionalCondition (
>     conditionName=0x55b6a1ff8800 "!parentIdx->rd_index->indisvalid",
> fileName=0x55b6a1fea7e0 "tablecmds.c", 
>     lineNumber=19206) at assert.c:66
> #6  0x000055b6a038ea9d in validatePartitionedIndex
> (partedIdx=0x7fc6e68a3ec8, partedTbl=0x7fc6e68a2368)
>     at tablecmds.c:19206

Thanks for the report!  This is not new in 16, it reproduces at
least as far back as v11.  I suppose we can't simply remove the
assertion, but have to figure out what should happen and write
code for that.

			regards, tom lane



Commits

  1. Fix marking of indisvalid for partitioned indexes at creation