Log Message:
-----------
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.

Tags:
----
REL8_2_STABLE

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        subselect.c (r1.112.2.1 -> r1.112.2.2)
        
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/subselect.c.diff?r1=1.112.2.1&r2=1.112.2.2)
    pgsql/src/test/regress/expected:
        subselect.out (r1.14 -> r1.14.2.1)
        
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/subselect.out.diff?r1=1.14&r2=1.14.2.1)
    pgsql/src/test/regress/sql:
        subselect.sql (r1.9 -> r1.9.2.1)
        
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/subselect.sql.diff?r1=1.9&r2=1.9.2.1)

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to