postgresql/src/backend
Tom Lane fb2d645dd5 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 a929e17e5a 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,
too.

No backpatch, as there does not seem to be a live problem before
a929e17e5a.  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.

Discussion: https://postgr.es/m/87sg8tqhsl.fsf@aurora.ydns.eu
Discussion: https://postgr.es/m/CAJKUy5gCXDSmFs2c=R+VGgn7FiYcLCsEFEuDNNLGfoha=pBE_g@mail.gmail.com
2021-02-01 14:05:51 -05:00
..
access Remove unused _bt_delitems_delete() argument. 2021-01-31 10:10:55 -08:00
bootstrap Update copyright for 2021 2021-01-02 13:06:25 -05:00
catalog SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
commands Adjust comments of CheckRelationTableSpaceMove() and SetRelationTableSpace() 2021-01-29 13:59:18 +09:00
executor Fix hash partition pruning with asymmetric partition sets. 2021-01-28 13:41:55 -05:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Update copyright for 2021 2021-01-02 13:06:25 -05:00
lib Update copyright for 2021 2021-01-02 13:06:25 -05:00
libpq Introduce --with-ssl={openssl} as a configure option 2021-02-01 19:19:44 +09:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
optimizer Fix error with CREATE PUBLICATION, wal_level=minimal, and new tables. 2021-01-30 00:11:38 -08:00
parser SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
partitioning Revise make_partition_pruneinfo to not use its partitioned_rels input. 2021-02-01 14:05:51 -05:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Update copyright for 2021 2021-01-02 13:06:25 -05:00
postmaster Add pg_stat_database counters for sessions and session time 2021-01-17 13:52:31 +01:00
regex Fix ancient bug in parsing of BRE-mode regular expressions. 2021-01-08 12:16:00 -05:00
replication Fix two typos in snapbuild.c. 2021-01-25 12:15:10 -08:00
rewrite SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
snowball Update copyright for 2021 2021-01-02 13:06:25 -05:00
statistics Update copyright for 2021 2021-01-02 13:06:25 -05:00
storage Fix CREATE INDEX CONCURRENTLY for simultaneous prepared transactions. 2021-01-30 00:00:27 -08:00
tcop Improve performance of repeated CALLs within plpgsql procedures. 2021-01-25 22:28:29 -05:00
tsearch Fix parsing of complex morphs to tsquery 2021-01-31 20:14:29 +03:00
utils SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
.gitignore
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00