pgsql: Remove rewriteTargetListIU's expansion of view targetlists in UP

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Remove rewriteTargetListIU's expansion of view targetlists in UP
Дата
Msg-id E1lb5VJ-0006rO-9q@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove rewriteTargetListIU's expansion of view targetlists in UPDATE.

Commit 2ec993a7c, which added triggers on views, modified the rewriter
to add dummy entries like "SET x = x" for all columns that weren't
actually being updated by the user in any UPDATE directed at a view.
That was needed at the time to produce a complete "NEW" row to pass
to the trigger.  Later it was found to cause problems for ordinary
updatable views, so commit cab5dc5da restricted it to happen only for
trigger-updatable views.  But in the wake of commit 86dc90056, we
really don't need it at all.  nodeModifyTable.c populates the trigger
"OLD" row from the whole-row variable that is generated for the view,
and then it computes the "NEW" row using that old row and the UPDATE
targetlist.  So there is no need for the UPDATE tlist to have dummy
entries, any more than it needs them for regular tables or other
types of views.

(The comments for rewriteTargetListIU suggest that we must do this
for correct expansion of NEW references in rules, but I now think
that that was just lazy comment editing in 2ec993a7c.  If we didn't
need it for rules on views before there were triggers, we don't need
it after that.)

This essentially propagates 86dc90056's decision that we don't need
dummy column updates into the view case.  Aside from making the
different cases more uniform and hence possibly forestalling future
bugs, it ought to save a little bit of rewriter/planner effort.

Discussion: https://postgr.es/m/2181213.1619397634@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/04942bffd0aa9bd0d143d99b473342eb9ecee88b

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 42 ++++--------------------------------
1 file changed, 4 insertions(+), 38 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Doc: document EXTRACT(JULIAN ...), improve Julian Date explanati
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: psql: tab-complete ALTER ... DETACH CONCURRENTLY / FINALIZE