postgresql/src
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
..
backend Generate EquivalenceClass members for partitionwise child join rels. 2019-11-05 11:42:24 -05:00
bin Stabilize pg_dump output order for similarly-named triggers and policies. 2019-11-04 16:25:05 -05:00
common Make the order of the header file includes consistent in non-backend modules. 2019-10-25 07:41:52 +05:30
fe_utils Make the order of the header file includes consistent in non-backend modules. 2019-10-25 07:41:52 +05:30
include Generate EquivalenceClass members for partitionwise child join rels. 2019-11-05 11:42:24 -05:00
interfaces Fix typos in the code 2019-10-30 10:03:00 +09:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Fix some compiler warnings on older compilers 2019-11-04 11:07:32 +01:00
port Make the order of the header file includes consistent in non-backend modules. 2019-10-25 07:41:52 +05:30
template Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
test Generate EquivalenceClass members for partitionwise child join rels. 2019-11-05 11:42:24 -05:00
timezone Update time zone data files to tzdata release 2019c. 2019-09-20 19:53:33 -04:00
tools For all ppc compilers, implement compare_exchange and fetch_add with asm. 2019-10-18 20:20:52 -07:00
tutorial Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
Makefile.shlib Clean up MinGW def file generation 2019-10-20 10:19:13 +02:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00