BUG #17076: Server crashes on composing an error message about invalid modulus for a new table partition

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 #17076: Server crashes on composing an error message about invalid modulus for a new table partition
Date: 2021-06-28 16:00:00
Message-ID: 17076-89a16ae835d329b9@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: 17076
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 14beta2
Operating system: Ubuntu 20.04
Description:

When executing the following query (based on create_table.sql):
CREATE TABLE hash_parted (a int) PARTITION BY HASH (a);
CREATE TABLE hpart_1 PARTITION OF hash_parted FOR VALUES WITH (MODULUS 10,
REMAINDER 0);
CREATE TABLE hpart_3 PARTITION OF hash_parted FOR VALUES WITH (MODULUS 200,
REMAINDER 2);
CREATE TABLE fail_part PARTITION OF hash_parted FOR VALUES WITH (MODULUS
150, REMAINDER 3);

Server crashes with the following stack:
Core was generated by `postgres: law regression [local] CREATE TABLE
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../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:50
#1 0x00007f032f726859 in __GI_abort () at abort.c:79
#2 0x00005577bdce1ea3 in ExceptionalCondition
(conditionName=conditionName(at)entry=0x5577bdef056c "strvalue != NULL",
errorType=errorType(at)entry=0x5577bdd4100b "FailedAssertion",
fileName=0x7ffe0bcd1ac0 "\204\036\316\275wU",
fileName(at)entry=0x5577bdef0561 "snprintf.c",
lineNumber=lineNumber(at)entry=442) at assert.c:69
#3 0x00005577bdd3f04c in dopr (target=target(at)entry=0x7ffe0bcd20a0,
format=0x5577bde49b5f "\".",
format(at)entry=0x5577bde49b10 "The new modulus %d is not a factor of %d,
the modulus of existing partition \"%s\".",
args=0x7ffe0bcd2150) at snprintf.c:442
#4 0x00005577bdd3f71f in pg_vsnprintf (str=<optimized out>,
count=<optimized out>, count(at)entry=1024,
fmt=fmt(at)entry=0x5577bde49b10 "The new modulus %d is not a factor of %d,
the modulus of existing partition \"%s\".",
args=args(at)entry=0x7ffe0bcd2150) at snprintf.c:195
#5 0x00005577bdd359f6 in pvsnprintf (buf=<optimized out>,
len=len(at)entry=1024,
fmt=fmt(at)entry=0x5577bde49b10 "The new modulus %d is not a factor of %d,
the modulus of existing partition \"%s\".",
args=args(at)entry=0x7ffe0bcd2150) at psprintf.c:110
#6 0x00005577bdd36de4 in appendStringInfoVA (str=str(at)entry=0x7ffe0bcd2130,

fmt=fmt(at)entry=0x5577bde49b10 "The new modulus %d is not a factor of %d,
the modulus of existing partition \"%s\".",
args=args(at)entry=0x7ffe0bcd2150) at stringinfo.c:149
#7 0x00005577bdce7042 in errdetail (
fmt=fmt(at)entry=0x5577bde49b10 "The new modulus %d is not a factor of %d,
the modulus of existing partition \"%s\".")
at elog.c:1051
#8 0x00005577bdaec445 in check_new_partition_bound
(relname=relname(at)entry=0x7ffe0bcd24a0 "fail_part",
parent=parent(at)entry=0x7f03223053b0, spec=spec(at)entry=0x5577bf9e9458,
pstate=pstate(at)entry=0x5577bf9e8188)
at partbounds.c:2902
#9 0x00005577bd9b068b in DefineRelation (stmt=stmt(at)entry=0x5577bf8fb3c8,
relkind=relkind(at)entry=114 'r', ownerId=10,
ownerId(at)entry=0, typaddress=typaddress(at)entry=0x0,
queryString=queryString(at)entry=0x5577bf8fa670 "CREATE TABLE fail_part
PARTITION OF hash_parted FOR VALUES WITH (MODULUS 150, REMAINDER 3);") at
tablecmds.c:1059
#10 0x00005577bdbad002 in ProcessUtilitySlow
(pstate=pstate(at)entry=0x5577bf91bf80, pstmt=pstmt(at)entry=0x5577bf8fb770,
queryString=queryString(at)entry=0x5577bf8fa670 "CREATE TABLE fail_part
PARTITION OF hash_parted FOR VALUES WITH (MODULUS 150, REMAINDER 3);",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0, dest=0x5577bf8fb840, qc=0x7ffe0bcd2ad0) at
utility.c:1146
#11 0x00005577bdbacd34 in standard_ProcessUtility (pstmt=0x5577bf8fb770,
queryString=0x5577bf8fa670 "CREATE TABLE fail_part PARTITION OF
hash_parted FOR VALUES WITH (MODULUS 150, REMAINDER 3);",
readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL, params=0x0,
queryEnv=0x0, dest=0x5577bf8fb840,
qc=0x7ffe0bcd2ad0) at utility.c:1049
#12 0x00005577bdbace1d in ProcessUtility (pstmt=pstmt(at)entry=0x5577bf8fb770,
queryString=<optimized out>,
readOnlyTree=<optimized out>,
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=<optimized out>,
queryEnv=<optimized out>, dest=0x5577bf8fb840, qc=0x7ffe0bcd2ad0) at
utility.c:527
#13 0x00005577bdbaa343 in PortalRunUtility
(portal=portal(at)entry=0x5577bf969570, pstmt=pstmt(at)entry=0x5577bf8fb770,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false, dest=dest(at)entry=0x5577bf8fb840,

qc=qc(at)entry=0x7ffe0bcd2ad0) at pquery.c:1147
#14 0x00005577bdbaa645 in PortalRunMulti
(portal=portal(at)entry=0x5577bf969570, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x5577bf8fb840, altdest=altdest(at)entry=0x5577bf8fb840,
qc=qc(at)entry=0x7ffe0bcd2ad0) at pquery.c:1304
#15 0x00005577bdbaaa79 in PortalRun (portal=portal(at)entry=0x5577bf969570,
count=count(at)entry=9223372036854775807,
isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true,
dest=dest(at)entry=0x5577bf8fb840,
altdest=altdest(at)entry=0x5577bf8fb840, qc=0x7ffe0bcd2ad0) at
pquery.c:786
#16 0x00005577bdba6cc6 in exec_simple_query (
query_string=query_string(at)entry=0x5577bf8fa670 "CREATE TABLE fail_part
PARTITION OF hash_parted FOR VALUES WITH (MODULUS 150, REMAINDER 3);") at
postgres.c:1214
#17 0x00005577bdba8c98 in PostgresMain (argc=argc(at)entry=1,
argv=argv(at)entry=0x7ffe0bcd2cc0, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4486
#18 0x00005577bdb03b65 in BackendRun (port=port(at)entry=0x5577bf91dee0) at
postmaster.c:4507
#19 0x00005577bdb06d7a in BackendStartup (port=port(at)entry=0x5577bf91dee0) at
postmaster.c:4229
#20 0x00005577bdb06fc1 in ServerLoop () at postmaster.c:1745
#21 0x00005577bdb0850e in PostmasterMain (argc=3, argv=<optimized out>) at
postmaster.c:1417
#22 0x00005577bda49158 in main (argc=3, argv=0x5577bf8f4930) at main.c:209

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-06-28 21:08:09 Re: BUG #17076: Server crashes on composing an error message about invalid modulus for a new table partition
Previous Message David G. Johnston 2021-06-28 15:51:52 Re: BUG #17075: Cannot commit when autoCommit is enabled