BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert
Date: 2024-06-09 06:00:00
Message-ID: 18500-62948b6fe5522f56@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18500
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 17beta1
Operating system: Ubuntu 22.04
Description:

The following script:
CREATE TABLE t (a integer) PARTITION BY RANGE (a);
CREATE TABLE tp (a integer PRIMARY KEY);
ALTER TABLE t ATTACH PARTITION tp FOR VALUES FROM (0) TO (1000);

CREATE UNIQUE INDEX t_a_idx ON t (a);
ALTER INDEX t_a_idx ATTACH PARTITION tp_pkey;

\d+ t*
ALTER TABLE t DETACH PARTITION tp;

triggers an assertion failure as below:
...
Partitioned index "public.t_a_idx"
Column | Type | Key? | Definition | Storage | Stats target
--------+---------+------+------------+---------+--------------
a | integer | yes | a | plain |
unique, btree, for table "public.t"
Partitions: tp_pkey
Access method: btree
...
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
connection to server was lost

TRAP: failed Assert("constrForm->coninhcount == 0"), File:
"pg_constraint.c", Line: 873, PID: 3272276
...
#5 0x000055b26dc9b76f in ExceptionalCondition (
conditionName=conditionName(at)entry=0x55b26dd2d254
"constrForm->coninhcount == 0",
fileName=fileName(at)entry=0x55b26dd2d230 "pg_constraint.c",
lineNumber=lineNumber(at)entry=873) at assert.c:66
#6 0x000055b26d8687d7 in ConstraintSetParentConstraint
(childConstrId=16392, parentConstrId=parentConstrId(at)entry=0,
childTableId=childTableId(at)entry=0) at pg_constraint.c:873
#7 0x000055b26d9361c7 in DetachPartitionFinalize
(rel=rel(at)entry=0x7f84a051d4b8, partRel=partRel(at)entry=0x7f84a0514428,
concurrent=concurrent(at)entry=false,
defaultPartOid=defaultPartOid(at)entry=0) at tablecmds.c:19306
#8 0x000055b26d94449a in ATExecDetachPartition
(wqueue=wqueue(at)entry=0x7fff8d338780, tab=tab(at)entry=0x55b26fcd6f90,
rel=rel(at)entry=0x7f84a051d4b8, name=<optimized out>, concurrent=false) at
tablecmds.c:19140
#9 0x000055b26d944fe0 in ATExecCmd (wqueue=wqueue(at)entry=0x7fff8d338780,
tab=tab(at)entry=0x55b26fcd6f90,
cmd=<optimized out>, lockmode=lockmode(at)entry=8,
cur_pass=cur_pass(at)entry=AT_PASS_MISC,
context=context(at)entry=0x7fff8d338890) at tablecmds.c:5515
...

Without asserts enabled, DETACH executed with no error.

Reproduced on REL_11_STABLE .. master.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Vedran Bilopavlović 2024-06-09 10:44:14 BUG: value in information_schema.parameters.parameter_default is always NULL for roles t
Previous Message Tom Lane 2024-06-08 22:52:53 Re: BUG #18499: Reindexing spgist index concurrently triggers Assert("TransactionIdIsValid(state->myXid)")