[sqlsmith] Failed assertion during partition pruning

From: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [sqlsmith] Failed assertion during partition pruning
Date: 2020-11-28 21:43:06
Message-ID: 87sg8tqhsl.fsf@aurora.ydns.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

testing master at 3df51ca8 with sqlsmith triggers the following
assertion:

TRAP: FailedAssertion("!bms_is_empty(present_parts)", File: "partprune.c", Line: 588, PID: 8540)

I looked at a dozen backtraces and they all sport a window aggregate but
that may still be random chance since sqlsmith really likes generating
these a lot... Below is the shortest recipe I found to reproduce it on a
fresh regression database:

--8<---------------cut here---------------start------------->8---
regression=# insert into trigger_parted values (1);
ERROR: control reached end of trigger procedure without RETURN
CONTEXT: PL/pgSQL function trigger_parted_trigfunc()
regression=# select myaggp05a(a) over (partition by a order by a) from trigger_parted where pg_trigger_depth() <> a limit 40;
server closed the connection unexpectedly
--8<---------------cut here---------------end--------------->8---

Backtrace of this one below.

regards,
Andreas

#2 0x000055bafaa95b81 in ExceptionalCondition (conditionName=conditionName(at)entry=0x55bafabe7812 "!bms_is_empty(present_parts)", errorType=errorType(at)entry=0x55bafaae901d "FailedAssertion", fileName=0x7ffee4fbbe40 "b[\251\372\272U",
fileName(at)entry=0x55bafabe765b "partprune.c", lineNumber=lineNumber(at)entry=588) at assert.c:69
#3 0x000055bafa8f02c0 in make_partitionedrel_pruneinfo (matchedsubplans=<synthetic pointer>, prunequal=<optimized out>, partrelids=<optimized out>, relid_subplan_map=0x55bafba17fd0, parentrel=0x55bafb928050, root=0x55bafb9f4f78) at partprune.c:588
#4 make_partition_pruneinfo (root=root(at)entry=0x55bafb9f4f78, parentrel=parentrel(at)entry=0x55bafb928050, subpaths=0x55bafba16c10, partitioned_rels=0x55bafba16d58, prunequal=prunequal(at)entry=0x55bafba17f78) at partprune.c:274
#5 0x000055bafa8b05cd in create_append_plan (root=0x55bafb9f4f78, best_path=0x55bafba16cc0, flags=6) at createplan.c:1249
#6 0x000055bafa8acd5e in create_windowagg_plan (best_path=0x55bafba174c0, root=0x55bafb9f4f78) at createplan.c:2452
#7 create_plan_recurse (root=0x55bafb9f4f78, best_path=0x55bafba174c0, flags=1) at createplan.c:492
#8 0x000055bafa8ad341 in create_limit_plan (flags=1, best_path=0x55bafba17910, root=0x55bafb9f4f78) at createplan.c:2699
#9 create_plan_recurse (root=0x55bafb9f4f78, best_path=0x55bafba17910, flags=1) at createplan.c:514
#10 0x000055bafa8b00d1 in create_plan (root=root(at)entry=0x55bafb9f4f78, best_path=<optimized out>) at createplan.c:333
#11 0x000055bafa8bf013 in standard_planner (parse=0x55bafb9287a8, query_string=<optimized out>, cursorOptions=256, boundParams=<optimized out>) at planner.c:409
#12 0x000055bafa989da8 in pg_plan_query (querytree=0x55bafb9287a8, querytree(at)entry=0x7ffee4fbc620,
query_string=query_string(at)entry=0x55bafb9082f0 "explain select myaggp05a(a) over (partition by a order by a) from trigger_parted where pg_trigger_depth() <> a limit 40;", cursorOptions=cursorOptions(at)entry=256, boundParams=boundParams(at)entry=0x0) at postgres.c:875
#13 0x000055bafa7b5dcf in ExplainOneQuery (query=0x7ffee4fbc620, cursorOptions=256, into=0x0, es=0x55bafb927f80, queryString=0x55bafb9082f0 "explain select myaggp05a(a) over (partition by a order by a) from trigger_parted where pg_trigger_depth() <> a limit 40;",
params=0x0, queryEnv=0x0) at explain.c:391
#14 0x000055bafa7b6507 in ExplainQuery (pstate=0x55bafb92a1c0, stmt=0x55bafb909930, params=0x0, dest=0x55bafb92a128) at ../../../src/include/nodes/nodes.h:592
#15 0x000055bafa98f87d in standard_ProcessUtility (pstmt=0x55bafb9c6090, queryString=0x55bafb9082f0 "explain select myaggp05a(a) over (partition by a order by a) from trigger_parted where pg_trigger_depth() <> a limit 40;", context=PROCESS_UTILITY_TOPLEVEL,
params=0x0, queryEnv=0x0, dest=0x55bafb92a128, qc=0x7ffee4fbc8c0) at utility.c:829
#16 0x000055bafa98cb36 in PortalRunUtility (portal=0x55bafb96b590, pstmt=0x55bafb9c6090, isTopLevel=<optimized out>, setHoldSnapshot=<optimized out>, dest=0x55bafb92a128, qc=0x7ffee4fbc8c0) at pquery.c:1159
#17 0x000055bafa98d910 in FillPortalStore (portal=0x55bafb96b590, isTopLevel=<optimized out>) at ../../../src/include/nodes/nodes.h:592
#18 0x000055bafa98e54d in PortalRun (portal=portal(at)entry=0x55bafb96b590, count=count(at)entry=9223372036854775807, isTopLevel=isTopLevel(at)entry=true, run_once=run_once(at)entry=true, dest=dest(at)entry=0x55bafb9c6180, altdest=altdest(at)entry=0x55bafb9c6180, qc=0x7ffee4fbcac0)
at pquery.c:751
#19 0x000055bafa98a29c in exec_simple_query (query_string=0x55bafb9082f0 "explain select myaggp05a(a) over (partition by a order by a) from trigger_parted where pg_trigger_depth() <> a limit 40;") at postgres.c:1239
#20 0x000055bafa98beaa in PostgresMain (argc=argc(at)entry=1, argv=argv(at)entry=0x7ffee4fbcff0, dbname=<optimized out>, username=<optimized out>) at postgres.c:4308
#21 0x000055bafa9054fa in BackendRun (port=<optimized out>, port=<optimized out>) at postmaster.c:4488
#22 BackendStartup (port=<optimized out>) at postmaster.c:4210
#23 ServerLoop () at postmaster.c:1727
#24 0x000055bafa906452 in PostmasterMain (argc=<optimized out>, argv=0x55bafb902c70) at postmaster.c:1400
#25 0x000055bafa65e980 in main (argc=3, argv=0x55bafb902c70) at main.c:209

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-11-28 22:52:28 Re: [sqlsmith] Failed assertion during partition pruning
Previous Message Bossart, Nathan 2020-11-28 21:28:52 Re: A few new options for CHECKPOINT