postgresql/src/include/optimizer
Tom Lane 8a14bdb10f 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.
2011-08-09 00:49:04 -04:00
..
clauses.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
cost.h Add an 'enable_material' GUC. 2010-04-19 00:55:26 +00:00
geqo.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
geqo_copy.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
geqo_gene.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
geqo_misc.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
geqo_mutation.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
geqo_pool.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
geqo_random.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
geqo_recombination.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
geqo_selection.h pgindent run for 9.0 2010-02-26 02:01:40 +00:00
joininfo.h Fix join-removal logic for pseudoconstant and outerjoin-delayed quals. 2010-09-14 23:15:37 +00:00
pathnode.h Rework join-removal logic as per recent discussion. In particular this 2010-03-28 22:59:34 +00:00
paths.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
placeholder.h Fix nested PlaceHolderVar expressions that appear only in targetlists. 2011-08-09 00:49:04 -04:00
plancat.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
planmain.h Fix nested PlaceHolderVar expressions that appear only in targetlists. 2011-08-09 00:49:04 -04:00
planner.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
predtest.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
prep.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
restrictinfo.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
subselect.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
tlist.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00
var.h Update copyright for the year 2010. 2010-01-02 16:58:17 +00:00