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)
commitc7f30e08a439ac0688bcecb17df4b0ffe0d1c6d9
tree5549b3eb42afc6af23674c057fb1ce4797590dc3
parent769a64c15c4733df2d89035b11c33d112ca79917
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