pgsql: Avoid a premature coercion failure in transformSetOperationTree()

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Avoid a premature coercion failure in transformSetOperationTree()
Дата
Msg-id 20091216222419.77683753FB7@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Avoid a premature coercion failure in transformSetOperationTree() when
presented with an UNKNOWN-type Var, which can happen in cases where an
unknown literal appeared in a subquery.  While many such cases will fail
later on anyway in the planner, there are some cases where the planner is
able to flatten the query and replace the Var by the constant before it has
to coerce the union column to the final type.  I had added this check in 8.4
to provide earlier/better error detection, but it causes a regression for
some cases that worked OK before.  Fix by not making the check if the input
node is UNKNOWN type and not a Const or Param.  If it isn't going to work,
it will fail anyway at plan time, with the only real loss being inability to
provide an error cursor.  Per gripe from Britt Piehler.

In passing, rename a couple of variables to remove confusion from an
inner scope masking the same variable names in an outer scope.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
    pgsql/src/backend/parser:
        analyze.c (r1.389.2.3 -> r1.389.2.4)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/analyze.c?r1=1.389.2.3&r2=1.389.2.4)
    pgsql/src/test/regress/expected:
        union.out (r1.14 -> r1.14.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/union.out?r1=1.14&r2=1.14.2.1)
    pgsql/src/test/regress/sql:
        union.sql (r1.8 -> r1.8.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/union.sql?r1=1.8&r2=1.8.2.1)

В списке pgsql-committers по дате отправления:

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Avoid a premature coercion failure in transformSetOperationTree()
Следующее
От: petere@postgresql.org (Peter Eisentraut)
Дата:
Сообщение: pgsql: If there is no sigdelset(), define it as a macro.