diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-10-24 12:52:43 +0200 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-10-24 12:52:43 +0200 |
commit | fb2a83b2b750a32ddfd107a75a3bc173f4f0a81f (patch) | |
tree | c509bb1109ab06e6d50812b0c8771e22657e9eea /src/backend/optimizer | |
parent | 4a6de748d3429cfa081942c46411d62341867bfd (diff) |
Update some comments that should've covered MERGE
Oversight in 7103ebb7aae8. Backpatch to 15.
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs48gnDjZXq3-b56dVpQCNUJ5hD9kdtWN4QFwKCEapspNsA@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r-- | src/backend/optimizer/path/indxpath.c | 13 | ||||
-rw-r--r-- | src/backend/optimizer/plan/planmain.c | 2 | ||||
-rw-r--r-- | src/backend/optimizer/plan/planner.c | 4 | ||||
-rw-r--r-- | src/backend/optimizer/util/appendinfo.c | 6 | ||||
-rw-r--r-- | src/backend/optimizer/util/inherit.c | 2 | ||||
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 3 | ||||
-rw-r--r-- | src/backend/optimizer/util/relnode.c | 2 |
7 files changed, 17 insertions, 15 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 0ef70ad7f11..b8000da56d9 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -3378,12 +3378,13 @@ check_index_predicates(PlannerInfo *root, RelOptInfo *rel) * Normally we remove quals that are implied by a partial index's * predicate from indrestrictinfo, indicating that they need not be * checked explicitly by an indexscan plan using this index. However, if - * the rel is a target relation of UPDATE/DELETE/SELECT FOR UPDATE, we - * cannot remove such quals from the plan, because they need to be in the - * plan so that they will be properly rechecked by EvalPlanQual testing. - * Some day we might want to remove such quals from the main plan anyway - * and pass them through to EvalPlanQual via a side channel; but for now, - * we just don't remove implied quals at all for target relations. + * the rel is a target relation of UPDATE/DELETE/MERGE/SELECT FOR UPDATE, + * we cannot remove such quals from the plan, because they need to be in + * the plan so that they will be properly rechecked by EvalPlanQual + * testing. Some day we might want to remove such quals from the main + * plan anyway and pass them through to EvalPlanQual via a side channel; + * but for now, we just don't remove implied quals at all for target + * relations. */ is_target_rel = (bms_is_member(rel->relid, root->all_result_relids) || get_plan_rowmark(root->rowMarks, rel->relid) != NULL); diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index c92ddd27ed1..5a1d00662fc 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -264,7 +264,7 @@ query_planner(PlannerInfo *root, add_other_rels_to_query(root); /* - * Distribute any UPDATE/DELETE row identity variables to the target + * Distribute any UPDATE/DELETE/MERGE row identity variables to the target * relations. This can't be done till we've finished expansion of * appendrels. */ diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 468105d91ea..453a598cad4 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -1747,7 +1747,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) if (bms_membership(root->all_result_relids) == BMS_MULTIPLE) { - /* Inherited UPDATE/DELETE */ + /* Inherited UPDATE/DELETE/MERGE */ RelOptInfo *top_result_rel = find_base_rel(root, parse->resultRelation); int resultRelation = -1; @@ -1874,7 +1874,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction) } else { - /* Single-relation INSERT/UPDATE/DELETE. */ + /* Single-relation INSERT/UPDATE/DELETE/MERGE. */ resultRelations = list_make1_int(parse->resultRelation); if (parse->commandType == CMD_UPDATE) updateColnosLists = list_make1(root->update_colnos); diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c index 9d4bb470270..38f51b6607b 100644 --- a/src/backend/optimizer/util/appendinfo.c +++ b/src/backend/optimizer/util/appendinfo.c @@ -748,7 +748,7 @@ find_appinfos_by_relids(PlannerInfo *root, Relids relids, int *nappinfos) /* * add_row_identity_var - * Register a row-identity column to be used in UPDATE/DELETE. + * Register a row-identity column to be used in UPDATE/DELETE/MERGE. * * The Var must be equal(), aside from varno, to any other row-identity * column with the same rowid_name. Thus, for example, "wholerow" @@ -927,8 +927,8 @@ add_row_identity_columns(PlannerInfo *root, Index rtindex, * distribute_row_identity_vars * * After we have finished identifying all the row identity columns - * needed by an inherited UPDATE/DELETE query, make sure that these - * columns will be generated by all the target relations. + * needed by an inherited UPDATE/DELETE/MERGE query, make sure that + * these columns will be generated by all the target relations. * * This is more or less like what build_base_rel_tlists() does, * except that it would not understand what to do with ROWID_VAR Vars. diff --git a/src/backend/optimizer/util/inherit.c b/src/backend/optimizer/util/inherit.c index 7e134822f36..6dbffe121a5 100644 --- a/src/backend/optimizer/util/inherit.c +++ b/src/backend/optimizer/util/inherit.c @@ -609,7 +609,7 @@ expand_single_inheritance_child(PlannerInfo *root, RangeTblEntry *parentrte, /* * If we are creating a child of the query target relation (only possible - * in UPDATE/DELETE), add it to all_result_relids, as well as + * in UPDATE/DELETE/MERGE), add it to all_result_relids, as well as * leaf_result_relids if appropriate, and make sure that we generate * required row-identity data. */ diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 2de5b0c8363..0762eb232e4 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -3613,7 +3613,8 @@ create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, /* * create_modifytable_path - * Creates a pathnode that represents performing INSERT/UPDATE/DELETE mods + * Creates a pathnode that represents performing INSERT/UPDATE/DELETE/MERGE + * mods * * 'rel' is the parent relation associated with the result * 'subpath' is a Path producing source data diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 520409f4ba0..3c75fd56f22 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -999,7 +999,7 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel, if (var->varno == ROWID_VAR) { - /* UPDATE/DELETE row identity vars are always needed */ + /* UPDATE/DELETE/MERGE row identity vars are always needed */ RowIdentityVarInfo *ridinfo = (RowIdentityVarInfo *) list_nth(root->row_identity_vars, var->varattno - 1); |