Fix an old thinko in SS_make_initplan_from_plan, which is used when optimizing
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 18 Jul 2007 21:41:22 +0000 (21:41 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 18 Jul 2007 21:41:22 +0000 (21:41 +0000)
commit369cf3c2bec434906c9044f0aa64f3d5eb4105a5
tree262d2e3815d1d3775bac24d99feda1946c3441c9
parentd13d55c10bc2a56632e99182dd9b958543b401f4
Fix an old thinko in SS_make_initplan_from_plan, which is used when optimizing
a MIN or MAX aggregate call into an indexscan: the initplan is being made at
the current query nesting level and so we shouldn't increment query_level.
Though usually harmless, this mistake could lead to bogus "plan should not
reference subplan's variable" failures on complex queries.  Per bug report
from David Sanchez i Gregori.
src/backend/optimizer/plan/subselect.c
src/test/regress/expected/subselect.out
src/test/regress/sql/subselect.sql