commit 4223f07877c02c6ab9e4ef8d1c324496bbb9708a Author: Simon Riggs Date: Wed Dec 22 11:27:10 2021 +0000 Copy editing on docs and resolve a couple of XXX comments diff --git a/doc/src/sgml/ref/merge.sgml b/doc/src/sgml/ref/merge.sgml index 89cf2d4443..ed5228fba1 100644 --- a/doc/src/sgml/ref/merge.sgml +++ b/doc/src/sgml/ref/merge.sgml @@ -98,16 +98,15 @@ DELETE - There is no MERGE privilege. - You must have the UPDATE privilege on the column(s) + There is no separate MERGE privilege. + If you specify an update action, you must have the + UPDATE privilege on the column(s) of the target_table_name - referred to in the SET clause - if you specify an update action, the INSERT privilege - on the target_table_name - if you specify an insert action and/or the DELETE - privilege on the target_table_name - if you specify a delete action on the - target_table_name. + that are referred to in the SET clause. + If you specify an insert action, you must have the INSERT + privilege on the target_table_name. + If you specify an delete action, you must have the DELETE + privilege on the target_table_name. Privileges are tested once at statement start and are checked whether or not particular WHEN clauses are executed. You will require the SELECT privilege on the @@ -118,9 +117,9 @@ DELETE MERGE is not supported if the - target_table_name has - RULES defined on it. - See for more information about RULES. + target_table_name is a + materialized view, foreign table or if it has any + RULEs defined on it. diff --git a/src/backend/parser/parse_merge.c b/src/backend/parser/parse_merge.c index 59d0722688..32a19ee024 100644 --- a/src/backend/parser/parse_merge.c +++ b/src/backend/parser/parse_merge.c @@ -344,10 +344,10 @@ transformMergeStmt(ParseState *pstate, MergeStmt *stmt) qry->rtable = pstate->p_rtable; /* - * XXX MERGE is unsupported in various cases + * MERGE is unsupported in various cases */ if (pstate->p_target_relation->rd_rel->relkind != RELKIND_RELATION && - pstate->p_target_relation->rd_rel->relkind != RELKIND_PARTITIONED_TABLE) + pstate->p_target_relation->rd_rel->relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("MERGE is not supported for this relation type"))); @@ -508,7 +508,7 @@ transformMergeStmt(ParseState *pstate, MergeStmt *stmt) qry->mergeActionList = mergeActionList; - /* XXX maybe later */ + /* RETURNING could potentially be added in the future, but not in SQL Std */ qry->returningList = NULL; qry->hasTargetSRFs = false;