Re: [sqlsmith] Failed assertion during partition pruning
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Seltenreich <seltenreich@gmx.de>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2020-11-28T22:52:28Z
Lists: pgsql-hackers
Andreas Seltenreich <seltenreich@gmx.de> writes:
> 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...
Yeah, it doesn't seem to need a window aggregate:
regression=# select a from trigger_parted where pg_trigger_depth() <> a order by a limit 40;
server closed the connection unexpectedly
What it looks like to me is that the code for setting up run-time
partition pruning has failed to consider the possibility of nested
partitioning: it's expecting that every partitioned table will have
at least one direct child that is a leaf. I'm not sure though
whether just the Assert is wrong, or there's more fundamental
issues here.
It's also somewhat interesting that you need the "order by a limit 40"
to get a crash. Poking around in the failing backend, I can see that
that causes the leaf-partition subplan to be an indexscan not a seqscan,
but it's far from clear why that'd make any difference to the partition
pruning logic.
regards, tom lane
Commits
-
Remove [Merge]AppendPath.partitioned_rels.
- f003a7522bfa 14.0 landed
-
Remove incidental dependencies on partitioned_rels lists.
- 5076f88bc985 14.0 landed
-
Revise make_partition_pruneinfo to not use its partitioned_rels input.
- fb2d645dd53f 14.0 landed
-
Fix two issues in TOAST decompression.
- dfc797730fc7 14.0 cited