pgsql: Improve ruleutils' printout of LATERAL references within subplan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve ruleutils' printout of LATERAL references within subplan
Date: 2022-11-17 01:06:39
Message-ID: E1ovTMV-000Wpi-4v@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Justin Pryzby 2022-11-17 03:15:43 Re: pg_upgrade test failure
Previous Message Thomas Munro 2022-11-16 22:31:23 pgsql: Fix slowdown in TAP tests due to recent walreceiver change.