mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Fix "wrong varnullingrels" for subquery nestloop parameters.
If we apply outer join identity 3 when relation C is a subquery having lateral references to relation B, then the lateral references within C continue to bear the original syntactically-correct varnullingrels marks, but that won't match what is available from the outer side of the nestloop. Compensate for that in process_subquery_nestloop_params(). This is a slightly hacky fix, but we certainly don't want to re-plan C in toto for each possible outer join order, so there's not a lot of better alternatives. Richard Guo and Tom Lane, per report from Markus Winand Discussion: https://postgr.es/m/DFBB2D25-DE97-49CA-A60E-07C881EA59A7@winand.at
This commit is contained in:
@@ -2289,9 +2289,11 @@ set_join_references(PlannerInfo *root, Join *join, int rtoffset)
|
||||
* the outer-join level at which they are used, Vars seen in the
|
||||
* NestLoopParam expression may have nullingrels that are just a
|
||||
* subset of those in the Vars actually available from the outer
|
||||
* side. Not checking this exactly is a bit grotty, but the work
|
||||
* needed to make things match up perfectly seems well out of
|
||||
* proportion to the value.
|
||||
* side. Another case that can cause that to happen is explained
|
||||
* in the comments for process_subquery_nestloop_params. Not
|
||||
* checking this exactly is a bit grotty, but the work needed to
|
||||
* make things match up perfectly seems well out of proportion to
|
||||
* the value.
|
||||
*/
|
||||
nlp->paramval = (Var *) fix_upper_expr(root,
|
||||
(Node *) nlp->paramval,
|
||||
|
||||
Reference in New Issue
Block a user