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-0004sp-I0@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_1_STABLE

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

Modified Files
--------------
src/backend/optimizer/util/var.c     |    3 ++-
src/backend/parser/parse_relation.c  |   29 ++++++++++++++++++++---------
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, 59 insertions(+), 35 deletions(-)


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Tweak FOR UPDATE/SHARE error message wording (again)
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Change post-rewriter representation of dropped columns in joinal