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

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 #16276: Server crash on an invalid attempt to attach a partition to an index
Date: 2020-02-25 16:00:01
Message-ID: 16276-5cd1dcc8fb8be7b5@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: 16276
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 12.2
Operating system: Ubuntu 18.04
Description:

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
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f323fe8c801 in __GI_abort () at abort.c:79
#2 0x0000561410882373 in ExceptionalCondition
(conditionName=conditionName(at)entry=0x561410986ee5 "cmd->bound == NULL",
errorType=errorType(at)entry=0x5614108dbf68 "FailedAssertion",
fileName=fileName(at)entry=0x561410986c97 "parse_utilcmd.c",
lineNumber=lineNumber(at)entry=3702) at assert.c:67
#3 0x000056141052a209 in transformPartitionCmd
(cxt=cxt(at)entry=0x7fff273a9d20, cmd=cmd(at)entry=0x561410fd5748)
at parse_utilcmd.c:3702
#4 0x000056141052aac4 in transformAlterTableStmt (relid=16388,
stmt=0x561410fd55e0, stmt(at)entry=0x561410fd54f8,
queryString=0x561410fad630 "alter table idxpart_idx attach partition
idxpart1 for values in (0);",
beforeStmts=beforeStmts(at)entry=0x7fff273a9e38,
afterStmts=afterStmts(at)entry=0x7fff273a9e40) at parse_utilcmd.c:3282
#5 0x000056141059aadc in ATParseTransformCmd
(wqueue=wqueue(at)entry=0x7fff273a9f80, tab=tab(at)entry=0x561411070bb8,
rel=rel(at)entry=0x7f3240fc4f50, cmd=0x56141103e3c8,
recurse=recurse(at)entry=false, lockmode=lockmode(at)entry=4,
cur_pass=10, context=0x7fff273aa090) at tablecmds.c:4661
#6 0x000056141059f170 in ATExecCmd (wqueue=wqueue(at)entry=0x7fff273a9f80,
tab=tab(at)entry=0x561411070bb8,
rel=rel(at)entry=0x7f3240fc4f50, cmd=<optimized out>,
lockmode=lockmode(at)entry=4, cur_pass=cur_pass(at)entry=10,
context=0x7fff273aa090) at tablecmds.c:4590
#7 0x000056141059f2de in ATRewriteCatalogs
(wqueue=wqueue(at)entry=0x7fff273a9f80, lockmode=lockmode(at)entry=4,
context=context(at)entry=0x7fff273aa090) at tablecmds.c:4286
#8 0x000056141059f53f in ATController
(parsetree=parsetree(at)entry=0x561410fae2e0, rel=rel(at)entry=0x7f3240fc4f50,
cmds=0x561410fae318, recurse=true, lockmode=lockmode(at)entry=4,
context=context(at)entry=0x7fff273aa090)
at tablecmds.c:3916
#9 0x000056141059f5c5 in AlterTable (stmt=stmt(at)entry=0x561410fae2e0,
lockmode=lockmode(at)entry=4,
context=context(at)entry=0x7fff273aa090) at tablecmds.c:3572
#10 0x00005614107637f3 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x56141103e2b0, pstmt=pstmt(at)entry=0x561410fae3c0,
queryString=queryString(at)entry=0x561410fad630 "alter table idxpart_idx
attach partition idxpart1 for values in (0);",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0,
dest=0x561410fae660, completionTag=0x7fff273aa5c0 "") at
utility.c:1276
#11 0x0000561410763327 in standard_ProcessUtility (pstmt=0x561410fae3c0,
queryString=0x561410fad630 "alter table idxpart_idx attach partition
idxpart1 for values in (0);",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x561410fae660, completionTag=0x7fff273aa5c0 "")
at utility.c:1076
#12 0x00005614107633d5 in ProcessUtility (pstmt=pstmt(at)entry=0x561410fae3c0,
queryString=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>,
dest=dest(at)entry=0x561410fae660, completionTag=0x7fff273aa5c0 "") at
utility.c:526
#13 0x000056141075f718 in PortalRunUtility
(portal=portal(at)entry=0x5614110149f0, pstmt=pstmt(at)entry=0x561410fae3c0,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x561410fae660,

completionTag=completionTag(at)entry=0x7fff273aa5c0 "") at pquery.c:1175
#14 0x00005614107603b4 in PortalRunMulti
(portal=portal(at)entry=0x5614110149f0, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x561410fae660, altdest=altdest(at)entry=0x561410fae660,
completionTag=completionTag(at)entry=0x7fff273aa5c0 "") at pquery.c:1321
#15 0x0000561410761127 in PortalRun (portal=portal(at)entry=0x5614110149f0,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x561410fae660,
altdest=altdest(at)entry=0x561410fae660, completionTag=0x7fff273aa5c0 "")
at pquery.c:796
#16 0x000056141075d1db in exec_simple_query (
query_string=query_string(at)entry=0x561410fad630 "alter table idxpart_idx
attach partition idxpart1 for values in (0);") at postgres.c:1227
#17 0x000056141075f357 in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x561410fd8ae0, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4291
#18 0x00005614106ceb8c in BackendRun (port=port(at)entry=0x561410fd11c0) at
postmaster.c:4509
#19 0x00005614106d1dbf in BackendStartup (port=port(at)entry=0x561410fd11c0) at
postmaster.c:4197
#20 0x00005614106d20d6 in ServerLoop () at postmaster.c:1727
#21 0x00005614106d3514 in PostmasterMain (argc=3, argv=<optimized out>) at
postmaster.c:1400
#22 0x0000561410622347 in main (argc=3, argv=0x561410fa7a00) at main.c:210

Reproduced on REL_11_0..master.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-02-25 18:58:57 BUG #16277: xmlelement allows invalid XML characters when XML version is set to 1.0
Previous Message Tomas Vondra 2020-02-25 15:05:34 Re: BUG #16275: we are facing error as psycopg2.errors.ProgramLimitExceeded: row is too big: size 24520, maximum