BUG #16577: Segfault on altering a table located in a dropped tablespace

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 #16577: Segfault on altering a table located in a dropped tablespace
Date: 2020-08-09 11:00:01
Message-ID: 16577-881633a9f9894fd5@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: 16577
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 13beta2
Operating system: Ubuntu 20.04
Description:

When executing the following query (a modified excerpt from the tablespace
regression test):
CREATE TABLESPACE regress_tblspace LOCATION '@testtablespace@';
CREATE TABLE test_default_tab_p(id bigint, val bigint)
PARTITION BY LIST (id) TABLESPACE regress_tblspace;
CREATE INDEX test_index2 on test_default_tab_p (val) TABLESPACE
regress_tblspace;
DROP TABLESPACE regress_tblspace;
\d+ test_default_tab_p;
ALTER TABLE test_default_tab_p ALTER val TYPE bigint;

I get a segfault with the stacktrace:
Core was generated by `postgres: law regression [local] ALTER TABLE
'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 quote_identifier (ident=0x0) at ruleutils.c:10754
10754 safe = ((ident[0] >= 'a' && ident[0] <= 'z') || ident[0] ==
'_');
(gdb) bt
#0 quote_identifier (ident=0x0) at ruleutils.c:10754
#1 0x000055cd6c3798d3 in pg_get_indexdef_worker
(indexrelid=indexrelid(at)entry=16389, colno=colno(at)entry=0,
excludeOps=excludeOps(at)entry=0x0, attrsOnly=attrsOnly(at)entry=false,
keysOnly=keysOnly(at)entry=false,
showTblSpc=showTblSpc(at)entry=true, inherits=true, prettyFlags=0,
missing_ok=false) at ruleutils.c:1460
#2 0x000055cd6c379ab1 in pg_get_indexdef_string
(indexrelid=indexrelid(at)entry=16389) at ruleutils.c:1161
#3 0x000055cd6c0ca0c1 in RememberIndexForRebuilding (indoid=16389,
tab=tab(at)entry=0x55cd6c89df20) at tablecmds.c:11718
#4 0x000055cd6c0cd764 in ATExecAlterColumnType
(tab=tab(at)entry=0x55cd6c89df20, rel=rel(at)entry=0x7f0e3cef3570,
cmd=<optimized out>, lockmode=lockmode(at)entry=8) at tablecmds.c:11280
#5 0x000055cd6c0dece5 in ATExecCmd (wqueue=wqueue(at)entry=0x7ffe0dcc7a30,
tab=tab(at)entry=0x55cd6c89df20,
rel=rel(at)entry=0x7f0e3cef3570, cmd=<optimized out>,
lockmode=lockmode(at)entry=8, cur_pass=cur_pass(at)entry=1,
context=0x7ffe0dcc7b40) at tablecmds.c:4523
#6 0x000055cd6c0df155 in ATRewriteCatalogs
(wqueue=wqueue(at)entry=0x7ffe0dcc7a30, lockmode=lockmode(at)entry=8,
context=context(at)entry=0x7ffe0dcc7b40) at
../../../src/include/nodes/nodes.h:594
#7 0x000055cd6c0df3a0 in ATController
(parsetree=parsetree(at)entry=0x55cd6c712040, rel=rel(at)entry=0x7f0e3cef3570,
cmds=0x55cd6c712008, recurse=true, lockmode=lockmode(at)entry=8,
context=context(at)entry=0x7ffe0dcc7b40)
at tablecmds.c:3971
#8 0x000055cd6c0df42a in AlterTable (stmt=stmt(at)entry=0x55cd6c712040,
lockmode=lockmode(at)entry=8,
context=context(at)entry=0x7ffe0dcc7b40) at tablecmds.c:3627
#9 0x000055cd6c2af6f8 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x55cd6c89ddb0, pstmt=pstmt(at)entry=0x55cd6c7120e8,
queryString=queryString(at)entry=0x55cd6c711350 "ALTER TABLE
test_default_tab_p ALTER val TYPE bigint;",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0,
dest=0x55cd6c712388, qc=0x7ffe0dcc8060) at utility.c:1269
#10 0x000055cd6c2af1f2 in standard_ProcessUtility (pstmt=0x55cd6c7120e8,
queryString=0x55cd6c711350 "ALTER TABLE test_default_tab_p ALTER val
TYPE bigint;",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
dest=0x55cd6c712388, qc=0x7ffe0dcc8060)
at utility.c:1069
#11 0x000055cd6c2af2d1 in ProcessUtility (pstmt=pstmt(at)entry=0x55cd6c7120e8,
queryString=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>,
dest=dest(at)entry=0x55cd6c712388, qc=0x7ffe0dcc8060) at utility.c:524
#12 0x000055cd6c2ab73c in PortalRunUtility
(portal=portal(at)entry=0x55cd6c7747f0, pstmt=pstmt(at)entry=0x55cd6c7120e8,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x55cd6c712388,

qc=qc(at)entry=0x7ffe0dcc8060) at pquery.c:1157
#13 0x000055cd6c2ac270 in PortalRunMulti
(portal=portal(at)entry=0x55cd6c7747f0, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x55cd6c712388, altdest=altdest(at)entry=0x55cd6c712388,
qc=qc(at)entry=0x7ffe0dcc8060) at pquery.c:1303
#14 0x000055cd6c2acf52 in PortalRun (portal=portal(at)entry=0x55cd6c7747f0,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x55cd6c712388,
altdest=altdest(at)entry=0x55cd6c712388, qc=0x7ffe0dcc8060) at
pquery.c:779
#15 0x000055cd6c2a93bc in exec_simple_query (
query_string=query_string(at)entry=0x55cd6c711350 "ALTER TABLE
test_default_tab_p ALTER val TYPE bigint;")
at postgres.c:1239
#16 0x000055cd6c2ab2d8 in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x55cd6c73ca88, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4315
#17 0x000055cd6c216e67 in BackendRun (port=port(at)entry=0x55cd6c735380) at
postmaster.c:4523
#18 0x000055cd6c219fdd in BackendStartup (port=port(at)entry=0x55cd6c735380) at
postmaster.c:4215
#19 0x000055cd6c21a224 in ServerLoop () at postmaster.c:1727
#20 0x000055cd6c21b74d in PostmasterMain (argc=8, argv=<optimized out>) at
postmaster.c:1400
#21 0x000055cd6c164bed in main (argc=8, argv=0x55cd6c70b9e0) at main.c:210

Best regards,
Alexander

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2020-08-09 13:20:54 Re: BUG #16577: Segfault on altering a table located in a dropped tablespace
Previous Message PG Bug reporting form 2020-08-07 15:52:52 BUG #16576: Creating a connection using psycopg2 results in "zombie" ccapiserver.exe processes on Windows