mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Centralize fixups for mismatched nullingrels in nestloop params.
It turns out that the fixes we applied in commitsbfd332b3fand63e4f13d2were not nearly enough to solve the problem. We'd focused narrowly on subquery RTEs with lateral references, but lateral references can occur in several other RTE kinds such as function RTEs. Putting the same hack into half a dozen code paths seems quite unattractive. Hence, revert the code changes (but not the test cases) from those commits and instead solve it centrally in identify_current_nestloop_params(), as Richard proposed originally. This is a bit annoying because it could mask erroneous nullingrels in nestloop params that are generated from non-LATERAL parameterized paths; but on balance I don't see a better way. Maybe at some future time we'll be motivated to find a more rigorous approach to nestloop params, but that's not happening for beta2. Richard Guo and Tom Lane Discussion: https://postgr.es/m/CAMbWs48Jcw-NvnxT23WiHP324wG44DvzcH1j4hc0Zn+3sR9cfg@mail.gmail.com
This commit is contained in:
@@ -2289,11 +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. Lateral references can create the same situation, as
|
||||
* explained in the comments for process_subquery_nestloop_params
|
||||
* and paraminfo_get_equal_hashops. 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. (Lateral references can also cause this, as explained in
|
||||
* the comments for identify_current_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