1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Allow partitionwise join to handle nested FULL JOIN USING cases.

This case didn't work because columns merged by FULL JOIN USING are
represented in the parse tree by COALESCE expressions, and the logic
for recognizing a partitionable join failed to match upper-level join
clauses to such expressions.  To fix, synthesize suitable COALESCE
expressions and add them to the nullable_partexprs lists.  This is
pretty ugly and brute-force, but it gets the job done.  (I have
ambitions of rethinking the way outer-join output Vars are
represented, so maybe that will provide a cleaner solution someday.
For now, do this.)

Amit Langote, reviewed by Justin Pryzby, Richard Guo, and myself

Discussion: https://postgr.es/m/CA+HiwqG2WVUGmLJqtR0tPFhniO=H=9qQ+Z3L_ZC+Y3-EVQHFGg@mail.gmail.com
This commit is contained in:
Tom Lane
2020-04-07 22:12:14 -04:00
parent c8434d64ce
commit 981643dcdb
4 changed files with 174 additions and 2 deletions

View File

@ -615,6 +615,9 @@ typedef struct PartitionSchemeData *PartitionScheme;
* that expression goes in the partexprs[i] list if the base relation
* is not nullable by this join or any lower outer join, or in the
* nullable_partexprs[i] list if the base relation is nullable.
* Furthermore, FULL JOINs add extra nullable_partexprs expressions
* corresponding to COALESCE expressions of the left and right join columns,
* to simplify matching join clauses to those lists.
*----------
*/
typedef enum RelOptKind