diff options
| author | Dean Rasheed | 2024-02-29 15:56:59 +0000 |
|---|---|---|
| committer | Dean Rasheed | 2024-02-29 15:56:59 +0000 |
| commit | 5f2e179bd31e5f5803005101eb12a8d7bf8db8f3 (patch) | |
| tree | 838a9f273c1d3d825db322161c0b8cdf3fbb0ce1 /src/backend/optimizer/util/appendinfo.c | |
| parent | 8b29a119fdaa381d6f75105f539b1e658c0f8cdb (diff) | |
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
Diffstat (limited to 'src/backend/optimizer/util/appendinfo.c')
| -rw-r--r-- | src/backend/optimizer/util/appendinfo.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c index 51fdeace7d2..6ba4eba224a 100644 --- a/src/backend/optimizer/util/appendinfo.c +++ b/src/backend/optimizer/util/appendinfo.c @@ -891,8 +891,7 @@ add_row_identity_columns(PlannerInfo *root, Index rtindex, Assert(commandType == CMD_UPDATE || commandType == CMD_DELETE || commandType == CMD_MERGE); - if (commandType == CMD_MERGE || - relkind == RELKIND_RELATION || + if (relkind == RELKIND_RELATION || relkind == RELKIND_MATVIEW || relkind == RELKIND_PARTITIONED_TABLE) { |
