create partition table caused server crashed with self-referencingforeign key - Mailing list pgsql-hackers

From Rajkumar Raghuwanshi
Subject create partition table caused server crashed with self-referencingforeign key
Date
Msg-id CAKcux6=z1dtiWw5BOpqDx-U6KTiq+zD0Y2m810zUtWL+giVXWA@mail.gmail.com
Whole thread Raw
Responses Re: create partition table caused server crashed withself-referencing foreign key  (amul sul <sulamul@gmail.com>)
List pgsql-hackers
Hi,

Getting a server crash while creating partition table which  have self-referencing foreign key

postgres=# CREATE TABLE part1 (c1 int PRIMARY KEY, c2 int REFERENCES part1) PARTITION BY LIST (c1);
CREATE TABLE
postgres=# CREATE TABLE part1_p1 PARTITION OF part1 FOR VALUES IN (1);
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

--stack-trace
[edb@localhost bin]$ gdb -q -c data/core.16883 postgres
Core was generated by `postgres: edb postgres [local] CREATE TABLE             '.
Program terminated with signal 6, Aborted.
#0  0x00000039212324f5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Missing separate debuginfos, use: debuginfo-install keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-65.el6.x86_64 libcom_err-1.41.12-24.el6.x86_64 libgcc-4.4.7-23.el6.x86_64 libselinux-2.0.94-7.el6.x86_64 openssl-1.0.1e-58.el6_10.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0  0x00000039212324f5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x0000003921233cd5 in abort () at abort.c:92
#2  0x0000000000acd16a in ExceptionalCondition (conditionName=0xc32310 "numfks == attmap->maplen", errorType=0xc2ea23 "FailedAssertion", fileName=0xc2f0bf "tablecmds.c", lineNumber=9046) at assert.c:67
#3  0x00000000006d1b6c in CloneFkReferenced (parentRel=0x7f3c80be2400, partitionRel=0x7f3c80be2a50) at tablecmds.c:9046
#4  0x00000000006d189b in CloneForeignKeyConstraints (wqueue=0x0, parentRel=0x7f3c80be2400, partitionRel=0x7f3c80be2a50) at tablecmds.c:8939
#5  0x00000000006c09a8 in DefineRelation (stmt=0x2ff25b8, relkind=114 'r', ownerId=10, typaddress=0x0, queryString=0x2f19810 "CREATE TABLE part1_p1 PARTITION OF part1 FOR VALUES IN (1);")
    at tablecmds.c:1151
#6  0x0000000000953021 in ProcessUtilitySlow (pstate=0x2ff24a0, pstmt=0x2f1a588, queryString=0x2f19810 "CREATE TABLE part1_p1 PARTITION OF part1 FOR VALUES IN (1);", context=PROCESS_UTILITY_TOPLEVEL,
    params=0x0, queryEnv=0x0, dest=0x2f1a868, qc=0x7ffffc1faa10) at utility.c:1154
#7  0x0000000000952dfe in standard_ProcessUtility (pstmt=0x2f1a588, queryString=0x2f19810 "CREATE TABLE part1_p1 PARTITION OF part1 FOR VALUES IN (1);", context=PROCESS_UTILITY_TOPLEVEL, params=0x0,
    queryEnv=0x0, dest=0x2f1a868, qc=0x7ffffc1faa10) at utility.c:1067
#8  0x0000000000951d18 in ProcessUtility (pstmt=0x2f1a588, queryString=0x2f19810 "CREATE TABLE part1_p1 PARTITION OF part1 FOR VALUES IN (1);", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,
    dest=0x2f1a868, qc=0x7ffffc1faa10) at utility.c:522
#9  0x0000000000950b48 in PortalRunUtility (portal=0x2f808c0, pstmt=0x2f1a588, isTopLevel=true, setHoldSnapshot=false, dest=0x2f1a868, qc=0x7ffffc1faa10) at pquery.c:1157
#10 0x0000000000950d6e in PortalRunMulti (portal=0x2f808c0, isTopLevel=true, setHoldSnapshot=false, dest=0x2f1a868, altdest=0x2f1a868, qc=0x7ffffc1faa10) at pquery.c:1303
#11 0x000000000095023a in PortalRun (portal=0x2f808c0, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x2f1a868, altdest=0x2f1a868, qc=0x7ffffc1faa10) at pquery.c:779
#12 0x000000000094a2a3 in exec_simple_query (query_string=0x2f19810 "CREATE TABLE part1_p1 PARTITION OF part1 FOR VALUES IN (1);") at postgres.c:1239
#13 0x000000000094e38e in PostgresMain (argc=1, argv=0x2f44998, dbname=0x2f448b0 "postgres", username=0x2f44890 "edb") at postgres.c:4315
#14 0x000000000089ba5d in BackendRun (port=0x2f3c7f0) at postmaster.c:4510
#15 0x000000000089b24c in BackendStartup (port=0x2f3c7f0) at postmaster.c:4202
#16 0x00000000008975be in ServerLoop () at postmaster.c:1727
#17 0x0000000000896f07 in PostmasterMain (argc=3, argv=0x2f14240) at postmaster.c:1400
#18 0x00000000007999cc in main (argc=3, argv=0x2f14240) at main.c:210

Thanks & Regards,
Rajkumar Raghuwanshi

pgsql-hackers by date:

Previous
From: Eugen Konkov
Date:
Subject: Re: [PATCH] distinct aggregates within a window function WIP
Next
From: amul sul
Date:
Subject: Re: create partition table caused server crashed withself-referencing foreign key