From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Support MERGE into updatable views. |
Date: | 2024-02-29 15:59:53 |
Message-ID: | E1rfip6-001PzS-KO@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Support MERGE into updatable views.
This allows the target relation of MERGE to be an auto-updatable or
trigger-updatable view, and includes support for WITH CHECK OPTION,
security barrier views, and security invoker views.
A trigger-updatable view must have INSTEAD OF triggers for every type
of action (INSERT, UPDATE, and DELETE) mentioned in the MERGE command.
An auto-updatable view must not have any INSTEAD OF triggers. Mixing
auto-update and trigger-update actions (i.e., having a partial set of
INSTEAD OF triggers) is not supported.
Rule-updatable views are also not supported, since there is no
rewriter support for non-SELECT rules with MERGE operations.
Dean Rasheed, reviewed by Jian He and Alvaro Herrera.
Discussion: https://postgr.es/m/CAEZATCVcB1g0nmxuEc-A+gGB0HnfcGQNGYH7gS=7rq0u0zOBXA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5f2e179bd31e5f5803005101eb12a8d7bf8db8f3
Modified Files
--------------
doc/src/sgml/ref/create_view.sgml | 42 +-
doc/src/sgml/ref/merge.sgml | 22 +-
doc/src/sgml/rules.sgml | 40 +-
src/backend/commands/copyfrom.c | 2 +-
src/backend/executor/execMain.c | 51 +--
src/backend/executor/execPartition.c | 4 +-
src/backend/executor/nodeModifyTable.c | 138 +++++--
src/backend/optimizer/prep/prepjointree.c | 20 +-
src/backend/optimizer/util/appendinfo.c | 3 +-
src/backend/parser/parse_merge.c | 21 +-
src/backend/rewrite/rewriteHandler.c | 403 +++++++++++++------
src/backend/rewrite/rewriteManip.c | 20 +-
src/bin/psql/tab-complete.c | 1 +
src/include/catalog/catversion.h | 2 +-
src/include/executor/executor.h | 3 +-
src/include/nodes/parsenodes.h | 8 +
src/include/rewrite/rewriteHandler.h | 6 +
src/test/regress/expected/merge.out | 10 -
src/test/regress/expected/rules.out | 12 +
src/test/regress/expected/updatable_views.out | 553 +++++++++++++++++++++++++-
src/test/regress/sql/merge.sql | 9 -
src/test/regress/sql/rules.sql | 13 +
src/test/regress/sql/updatable_views.sql | 285 ++++++++++++-
23 files changed, 1380 insertions(+), 288 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2024-02-29 16:04:08 | pgsql: Introduce atomic read/write functions with full barrier semantic |
Previous Message | Peter Eisentraut | 2024-02-29 13:14:12 | pgsql: Add missing RangeTblEntry field to jumble |