pgsql: Improve handling of unknown-type literals in UNION/INTERSECT/EXC

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Improve handling of unknown-type literals in UNION/INTERSECT/EXC
Дата
Msg-id E1PzfuQ-0001gR-2x@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Improve handling of unknown-type literals in UNION/INTERSECT/EXCEPT.

This patch causes unknown-type Consts to be coerced to the resolved output
type of the set operation at parse time.  Formerly such Consts were left
alone until late in the planning stage.  The disadvantage of that approach
is that it disables some optimizations, because the planner sees the set-op
leaf query as having different output column types than the overall set-op.
We saw an example of that in a recent performance gripe from Claudio
Freire.

Fixing such a Const requires scribbling on the leaf query in
transformSetOperationTree, but that should be all right since if the leaf
query's semantics depended on that output column, it would already have
resolved the unknown to something else.

Most of the bulk of this patch is a simple adjustment of
transformSetOperationTree's API so that upper levels can get at the
TargetEntry containing a Const to be replaced: it now returns a list of
TargetEntries, instead of just the bare expressions.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/72cfc17aef4fc9aa2de1c82045b7d609c0f2c513

Modified Files
--------------
src/backend/parser/analyze.c |  150 +++++++++++++++++++++++++++---------------
1 files changed, 96 insertions(+), 54 deletions(-)


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: pgsql: Remove unused copy_dir() function from pg_upgrade.
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Corrections to CREATE FOREIGN TABLE documentation.