pgsql: Fix an old thinko in SS_make_initplan_from_plan, which is used - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Fix an old thinko in SS_make_initplan_from_plan, which is used
Date
Msg-id 20070718214058.0BC089FBF66@postgresql.org
Whole thread Raw
List pgsql-committers
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.

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        subselect.c (r1.122 -> r1.123)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/subselect.c.diff?r1=1.122&r2=1.123)
    pgsql/src/test/regress/expected:
        subselect.out (r1.15 -> r1.16)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/subselect.out.diff?r1=1.15&r2=1.16)
    pgsql/src/test/regress/sql:
        subselect.sql (r1.10 -> r1.11)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/subselect.sql.diff?r1=1.10&r2=1.11)

pgsql-committers by date:

Previous
From: alvherre@postgresql.org (Alvaro Herrera)
Date:
Subject: pgsql: Cast NULL to a pointer type in the execl() call, to avoid a
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix an old thinko in SS_make_initplan_from_plan, which is used