From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix nested PlaceHolderVar expressions that appear only in target |
Date: | 2011-08-09 04:50:23 |
Message-ID: | E1QqeGl-00087A-QV@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix nested PlaceHolderVar expressions that appear only in targetlists.
A PlaceHolderVar's expression might contain another, lower-level
PlaceHolderVar. If the outer PlaceHolderVar is used, the inner one
certainly will be also, and so we have to make sure that both of them get
into the placeholder_list with correct ph_may_need values during the
initial pre-scan of the query (before deconstruct_jointree starts).
We did this correctly for PlaceHolderVars appearing in the query quals,
but overlooked the issue for those appearing in the top-level targetlist;
with the result that nested placeholders referenced only in the targetlist
did not work correctly, as illustrated in bug #6154.
While at it, add some error checking to find_placeholder_info to ensure
that we don't try to create new placeholders after it's too late to do so;
they have to all be created before deconstruct_jointree starts.
Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.
Branch
------
REL9_1_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/028a0c5a2913f18c954845cc014786912f39fa30
Modified Files
--------------
src/backend/optimizer/path/costsize.c | 2 +-
src/backend/optimizer/path/equivclass.c | 2 +-
src/backend/optimizer/plan/initsplan.c | 27 ++++++----
src/backend/optimizer/util/placeholder.c | 84 ++++++++++++++++++++---------
src/include/optimizer/placeholder.h | 4 +-
src/include/optimizer/planmain.h | 2 +-
src/test/regress/expected/join.out | 45 ++++++++++++++++
src/test/regress/sql/join.sql | 37 +++++++++++++
8 files changed, 163 insertions(+), 40 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2011-08-09 08:46:43 | pgsql: Fix grammar and spelling in log message. |
Previous Message | Robert Haas | 2011-08-08 20:31:07 | pgsql: Teach psql to display the comments on SQL/MED objects in verbose |