pgsql: Further hacking on ruleutils' new column-alias-assignment code.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Further hacking on ruleutils' new column-alias-assignment code.
Дата
Msg-id E1V1kZB-0006Ob-R6@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Further hacking on ruleutils' new column-alias-assignment code.

After further thought about implicit coercions appearing in a joinaliasvars
list, I realized that they represent an additional reason why we might need
to reference the join output column directly instead of referencing an
underlying column.  Consider SELECT x FROM t1 LEFT JOIN t2 USING (x) where
t1.x is of type date while t2.x is of type timestamptz.  The merged output
variable is of type timestamptz, but it won't go to null when t2 does,
therefore neither t1.x nor t2.x is a valid substitute reference.

The code in get_variable() actually gets this case right, since it knows
it shouldn't look through a coercion, but we failed to ensure that the
unqualified output column name would be globally unique.  To fix, modify
the code that trawls for a dangerous situation so that it actually scans
through an unnamed join's joinaliasvars list to see if there are any
non-simple-Var entries.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ef655663c5069231e054c3514c3ee9b15b8a4f13

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         |   92 +++++++++++++++++------------
src/test/regress/expected/create_view.out |   28 +++++++++
src/test/regress/sql/create_view.sql      |   13 ++++
3 files changed, 94 insertions(+), 39 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Further hacking on ruleutils' new column-alias-assignment code.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Move strip_implicit_coercions() from optimizer to nodeFuncs.c.