[sqlsmith] Failed assertion during partition pruning - Mailing list pgsql-hackers

From Andreas Seltenreich
Subject [sqlsmith] Failed assertion during partition pruning
Date
Msg-id 87sg8tqhsl.fsf@aurora.ydns.eu
Whole thread Raw
Responses Re: [sqlsmith] Failed assertion during partition pruning  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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
limit40; 
server closed the connection unexpectedly
--8<---------------cut here---------------end--------------->8---

Backtrace of this one below.

regards,
Andreas

#2  0x000055bafaa95b81 in ExceptionalCondition (conditionName=conditionName@entry=0x55bafabe7812
"!bms_is_empty(present_parts)",errorType=errorType@entry=0x55bafaae901d "FailedAssertion", fileName=0x7ffee4fbbe40
"b[\251\372\272U",
    fileName@entry=0x55bafabe765b "partprune.c", lineNumber=lineNumber@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@entry=0x55bafb9f4f78, parentrel=parentrel@entry=0x55bafb928050,
subpaths=0x55bafba16c10,partitioned_rels=0x55bafba16d58, prunequal=prunequal@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@entry=0x55bafb9f4f78, best_path=<optimized out>) at createplan.c:333
#11 0x000055bafa8bf013 in standard_planner (parse=0x55bafb9287a8, query_string=<optimized out>, cursorOptions=256,
boundParams=<optimizedout>) at planner.c:409 
#12 0x000055bafa989da8 in pg_plan_query (querytree=0x55bafb9287a8, querytree@entry=0x7ffee4fbc620,
    query_string=query_string@entry=0x55bafb9082f0 "explain select myaggp05a(a) over (partition by a order by a) from
trigger_partedwhere pg_trigger_depth() <> a limit 40;", cursorOptions=cursorOptions@entry=256,
boundParams=boundParams@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=<optimizedout>, 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@entry=0x55bafb96b590, count=count@entry=9223372036854775807,
isTopLevel=isTopLevel@entry=true,run_once=run_once@entry=true, dest=dest@entry=0x55bafb9c6180,
altdest=altdest@entry=0x55bafb9c6180,qc=0x7ffee4fbcac0) 
    at pquery.c:751
#19 0x000055bafa98a29c in exec_simple_query (query_string=0x55bafb9082f0 "explain select myaggp05a(a) over (partition
bya order by a) from trigger_parted where pg_trigger_depth() <> a limit 40;") at postgres.c:1239 
#20 0x000055bafa98beaa in PostgresMain (argc=argc@entry=1, argv=argv@entry=0x7ffee4fbcff0, dbname=<optimized out>,
username=<optimizedout>) 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



pgsql-hackers by date:

Previous
From: "Bossart, Nathan"
Date:
Subject: Re: A few new options for CHECKPOINT
Next
From: Tom Lane
Date:
Subject: Re: [sqlsmith] Failed assertion during partition pruning