|From:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>|
|Subject:||pgsql: Revise make_partition_pruneinfo to not use its partitioned_rels|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Revise make_partition_pruneinfo to not use its partitioned_rels input.
It turns out that the calculation of [Merge]AppendPath.partitioned_rels
in allpaths.c is faulty and sometimes omits relevant non-leaf partitions,
allowing an assertion added by commit a929e17e5a8 to trigger. Rather
than fix that, it seems better to get rid of those fields altogether.
We don't really need the info until create_plan time, and calculating
it once for the selected plan should be cheaper than calculating it
for each append path we consider.
As a first step, teach make_partition_pruneinfo to collect the relevant
partitioned tables for itself. It's not hard to do so by traversing
from child tables up to parents using the AppendRelInfo links.
While here, make some minor stylistic improvements; mainly, don't use
the "Relids" alias for bitmapsets that are not identities of any
relation considered by the planner. Try to document the logic better,
No backpatch, as there does not seem to be a live problem before
a929e17e5a8. Also no new regression test; the code where the bug
was will be gone at the end of this patch series, so it seems a
bit pointless to memorialize the issue.
Tom Lane and David Rowley, per reports from Andreas Seltenreich
and Jaime Casanova.
src/backend/partitioning/partprune.c | 199 ++++++++++++++++++++++++++---------
1 file changed, 149 insertions(+), 50 deletions(-)
|Next Message||Tom Lane||2021-02-01 19:44:20||pgsql: Remove [Merge]AppendPath.partitioned_rels.|
|Previous Message||Peter Eisentraut||2021-02-01 13:53:37||pgsql: SEARCH and CYCLE clauses|