postgresql/src/backend
Tom Lane 529ebb20aa Generate EquivalenceClass members for partitionwise child join rels.
Commit d25ea0127 got rid of what I thought were entirely unnecessary
derived child expressions in EquivalenceClasses for EC members that
mention multiple baserels.  But it turns out that some of the child
expressions that code created are necessary for partitionwise joins,
else we fail to find matching pathkeys for Sort nodes.  (This happens
only for certain shapes of the resulting plan; it may be that
partitionwise aggregation is also necessary to show the failure,
though I'm not sure of that.)

Reverting that commit entirely would be quite painful performance-wise
for large partition sets.  So instead, add code that explicitly
generates child expressions that match only partitionwise child join
rels we have actually generated.

Per report from Justin Pryzby.  (Amit Langote noticed the problem
earlier, though it's not clear if he recognized then that it could
result in a planner error, not merely failure to exploit partitionwise
join, in the code as-committed.)  Back-patch to v12 where commit
d25ea0127 came in.

Amit Langote, with lots of kibitzing from me

Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com
Discussion: https://postgr.es/m/20191011143703.GN10470@telsasoft.com
2019-11-05 11:42:24 -05:00
..
access Refactor code building relation options 2019-11-05 09:17:05 +09:00
bootstrap Fix inconsistencies and typos in the tree 2019-07-16 13:23:53 +09:00
catalog PG_FINALLY 2019-11-01 11:18:03 +01:00
commands Fix failure when creating cloned indexes for a partition 2019-11-02 14:16:04 +09:00
executor Rename some toasting functions based on whether they are heap-specific. 2019-10-04 14:24:46 -04:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Don't generate EEOP_*_FETCHSOME operations for slots know to be virtual. 2019-09-30 16:06:16 -07:00
lib Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
libpq PG_FINALLY 2019-11-01 11:18:03 +01:00
main initdb: Remove obsolete locale handling 2019-08-14 06:51:13 +02:00
nodes Avoid trying to release a List's initial allocation via repalloc(). 2019-10-06 12:06:30 -04:00
optimizer Generate EquivalenceClass members for partitionwise child join rels. 2019-11-05 11:42:24 -05:00
parser Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING DEFAULTS. 2019-09-25 17:30:42 -04:00
partitioning Update obsolete comment. 2019-10-21 17:30:00 +09:00
po Translation updates 2019-06-17 15:30:20 +02:00
port Remove mingwcompat.c 2019-09-17 11:34:28 +02:00
postmaster Clean up properly error_context_stack in autovacuum worker on exception 2019-10-23 10:25:06 +09:00
regex Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
replication Add some assertions in syncrep.c 2019-11-01 22:51:05 +09:00
rewrite Rationalize use of list_concat + list_copy combinations. 2019-08-12 11:20:18 -04:00
snowball Sync our Snowball stemmer dictionaries with current upstream 2019-07-04 13:26:48 +02:00
statistics Fix typos in the code 2019-10-30 10:03:00 +09:00
storage Fix typos in the code 2019-10-30 10:03:00 +09:00
tcop PG_FINALLY 2019-11-01 11:18:03 +01:00
tsearch Suppress warning from older compilers. 2019-11-03 16:10:23 -05:00
utils Fix some compiler warnings on older compilers 2019-11-04 11:07:32 +01:00
.gitignore
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2019-05-20 16:00:53 +02:00