pgsql: Improve ruleutils' printout of LATERAL references within subplan - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Improve ruleutils' printout of LATERAL references within subplan
Date
Msg-id E1ovTMV-000Wpi-4v@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve ruleutils' printout of LATERAL references within subplans.

Commit 1cc29fe7c, which taught EXPLAIN to print PARAM_EXEC Params as
the referenced expressions, included some checks to prevent matching
Params found in SubPlans or InitPlans to NestLoopParams of upper query
levels.  At the time, this seemed possibly necessary to avoid false
matches because of the planner's habit of re-using the same PARAM_EXEC
slot in multiple places in a plan.  Furthermore, in the absence of
LATERAL no such reference could be valid anyway.  But it's possible
now that we have LATERAL, and in the wake of 46c508fbc and 1db5667ba
I believe the false-match hazard is gone.  Hence, remove the
in_same_plan_level checks.  As shown in the regression test changes,
this provides a useful improvement in readability for EXPLAIN of
LATERAL-using subplans.

Richard Guo, reviewed by Greg Stark and myself

Discussion: https://postgr.es/m/CAMbWs4-YSOcQXAagJetP95cAeZPqzOy5kM5yijG0PVW5ztRb4w@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/adaf34241acd83afaa45a8b614b6484a285da847

Modified Files
--------------
src/backend/utils/adt/ruleutils.c       | 33 ++++-----------------------------
src/test/regress/expected/join.out      |  8 ++++----
src/test/regress/expected/subselect.out |  2 +-
3 files changed, 9 insertions(+), 34 deletions(-)


pgsql-committers by date:

Previous
From: Thomas Munro
Date:
Subject: pgsql: Fix slowdown in TAP tests due to recent walreceiver change.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Update some more ObjectType switch statements to not have defaul