pgsql: Change post-rewriter representation of dropped columns in joinal

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Change post-rewriter representation of dropped columns in joinal
Дата
Msg-id E1V1j81-0004st-KG@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Change post-rewriter representation of dropped columns in joinaliasvars.

It's possible to drop a column from an input table of a JOIN clause in a
view, if that column is nowhere actually referenced in the view.  But it
will still be there in the JOIN clause's joinaliasvars list.  We used to
replace such entries with NULL Const nodes, which is handy for generation
of RowExpr expansion of a whole-row reference to the view.  The trouble
with that is that it can't be distinguished from the situation after
subquery pull-up of a constant subquery output expression below the JOIN.
Instead, replace such joinaliasvars with null pointers (empty expression
trees), which can't be confused with pulled-up expressions.  expandRTE()
still emits the old convention, though, for convenience of RowExpr
generation and to reduce the risk of breaking extension code.

In HEAD and 9.3, this patch also fixes a problem with some new code in
ruleutils.c that was failing to cope with implicitly-casted joinaliasvars
entries, as per recent report from Feike Steenbergen.  That oversight was
because of an inadequate description of the data structure in parsenodes.h,
which I've now corrected.  There were some pre-existing oversights of the
same ilk elsewhere, which I believe are now all fixed.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/04836087aab1500754a1de16744c4fcf8d4f0c5b

Modified Files
--------------
src/backend/optimizer/util/var.c     |    3 ++-
src/backend/parser/parse_relation.c  |   28 +++++++++++++++++++---------
src/backend/parser/parse_target.c    |    3 +++
src/backend/rewrite/rewriteHandler.c |   32 ++++++++++++++++----------------
src/backend/utils/adt/ruleutils.c    |    5 ++++-
src/include/nodes/parsenodes.h       |   22 ++++++++++++++--------
6 files changed, 58 insertions(+), 35 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Change post-rewriter representation of dropped columns in joinal
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Change post-rewriter representation of dropped columns in joinal