citus
citus copied to clipboard
ALTER TABLE ADD COLUMN commands may cause crash.
Repro steps:
> drop table lt;
> drop table rt;
>
> create table lt(i int);
> select citus_add_local_table_to_metadata($$citus.lt$$);
>
> create table rt(j int primary key, k int unique);
> select create_reference_table('rt');
>
>
> alter table lt add column is_nds bool,
> add column new_col int references rt;
Program received signal SIGSEGV, Segmentation fault.
0x00007fd865d67151 in ErrorUnsupportedAlterTableAddColumn (relationId=17269, command=0x56160801ed50, constraint=0x56160801f088) at commands/table.c:3056
3056 char *referencedColumn = strVal(lfirst(list_head(constraint->pk_attrs)));
(gdb) bt
#0 0x00007fd865d67151 in ErrorUnsupportedAlterTableAddColumn (relationId=17269, command=0x56160801ed50, constraint=0x56160801f088)
at commands/table.c:3056
#1 0x00007fd865d66648 in PostprocessAlterTableStmt (alterTableStatement=0x56160801ea58) at commands/table.c:2681
#2 0x00007fd865d70d7a in citus_ProcessUtilityInternal (pstmt=0x56160801e948,
queryString=0x561607da2e08 "alter table lt add column is_nds bool,\n", ' ' <repeats 15 times>, "add column new_col int references rt;", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x561607da4798, completionTag=0x7ffd4aea2ec0)
at commands/utility_hook.c:861
#3 0x00007fd865d6ff8c in citus_ProcessUtility (pstmt=0x561607da3f68,
queryString=0x561607da2e08 "alter table lt add column is_nds bool,\n", ' ' <repeats 15 times>, "add column new_col int references rt;", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x561607da4798, completionTag=0x7ffd4aea2ec0)
at commands/utility_hook.c:357
#4 0x00007fd8651b7969 in pgss_ProcessUtility (pstmt=0x561607da3f68,
queryString=0x561607da2e08 "alter table lt add column is_nds bool,\n", ' ' <repeats 15 times>, "add column new_col int references rt;", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x561607da4798, qc=0x7ffd4aea2ec0)
at pg_stat_statements.c:1141
#5 0x00005616064e64f8 in ProcessUtility (pstmt=0x561607da3f68,
queryString=0x561607da2e08 "alter table lt add column is_nds bool,\n", ' ' <repeats 15 times>, "add column new_col int references rt;", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x561607da4798, qc=0x7ffd4aea2ec0)
at utility.c:526
#6 0x00005616064e4dfb in PortalRunUtility (portal=0x561607eb8d88, pstmt=0x561607da3f68, isTopLevel=true, setHoldSnapshot=false,
dest=0x561607da4798, qc=0x7ffd4aea2ec0) at pquery.c:1158
#7 0x00005616064e5072 in PortalRunMulti (portal=0x561607eb8d88, isTopLevel=true, setHoldSnapshot=false, dest=0x561607da4798,
altdest=0x561607da4798, qc=0x7ffd4aea2ec0) at pquery.c:1315
#8 0x00005616064e44bc in PortalRun (portal=0x561607eb8d88, count=9223372036854775807, isTopLevel=true, run_once=true,
dest=0x561607da4798, altdest=0x561607da4798, qc=0x7ffd4aea2ec0) at pquery.c:791
#9 0x00005616064dd1cb in exec_simple_query (
query_string=0x561607da2e08 "alter table lt add column is_nds bool,\n", ' ' <repeats 15 times>, "add column new_col int references rt;") at postgres.c:1274
#10 0x00005616064e2239 in PostgresMain (dbname=0x561607e74c40 "emel", username=0x561607e74c28 "emel") at postgres.c:4637
#11 0x000056160640320c in BackendRun (port=0x561607e70e60) at postmaster.c:4464
#12 0x0000561606402a98 in BackendStartup (port=0x561607e70e60) at postmaster.c:4192
#13 0x00005616063fed23 in ServerLoop () at postmaster.c:1782
#14 0x00005616063fe5cd in PostmasterMain (argc=5, argv=0x561607d09d70) at postmaster.c:1466