diff options
Diffstat (limited to 'src/backend/rewrite/rewriteHandler.c')
-rw-r--r-- | src/backend/rewrite/rewriteHandler.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index 33df6aecd6c..b458de69711 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -55,7 +55,7 @@ static void rewriteValuesRTE(RangeTblEntry *rte, Relation target_relation, static void rewriteTargetListUD(Query *parsetree, RangeTblEntry *target_rte, Relation target_relation); static void markQueryForLocking(Query *qry, Node *jtnode, - bool forUpdate, bool noWait, bool pushedDown); + LockClauseStrength strength, bool noWait, bool pushedDown); static List *matchLocks(CmdType event, RuleLock *rulelocks, int varno, Query *parsetree); static Query *fireRIRrules(Query *parsetree, List *activeRIRs, @@ -68,7 +68,7 @@ static Query *fireRIRrules(Query *parsetree, List *activeRIRs, * These locks will ensure that the relation schemas don't change under us * while we are rewriting and planning the query. * - * forUpdatePushedDown indicates that a pushed-down FOR UPDATE/SHARE applies + * forUpdatePushedDown indicates that a pushed-down FOR [KEY] UPDATE/SHARE applies * to the current subquery, requiring all rels to be opened with RowShareLock. * This should always be false at the start of the recursion. * @@ -130,7 +130,7 @@ AcquireRewriteLocks(Query *parsetree, bool forUpdatePushedDown) * * If the relation is the query's result relation, then we * need RowExclusiveLock. Otherwise, check to see if the - * relation is accessed FOR UPDATE/SHARE or not. We can't + * relation is accessed FOR [KEY] UPDATE/SHARE or not. We can't * just grab AccessShareLock because then the executor would * be trying to upgrade the lock, leading to possible * deadlocks. @@ -1357,7 +1357,7 @@ ApplyRetrieveRule(Query *parsetree, } /* - * If FOR UPDATE/SHARE of view, be sure we get right initial lock on the + * If FOR [KEY] UPDATE/SHARE of view, be sure we get right initial lock on the * relations it references. */ rc = get_parse_rowmark(parsetree, rt_index); @@ -1405,8 +1405,8 @@ ApplyRetrieveRule(Query *parsetree, rte->modifiedCols = NULL; /* - * If FOR UPDATE/SHARE of view, mark all the contained tables as implicit - * FOR UPDATE/SHARE, the same as the parser would have done if the view's + * If FOR [KEY] UPDATE/SHARE of view, mark all the contained tables as implicit + * FOR [KEY] UPDATE/SHARE, the same as the parser would have done if the view's * subquery had been written out explicitly. * * Note: we don't consider forUpdatePushedDown here; such marks will be @@ -1414,13 +1414,13 @@ ApplyRetrieveRule(Query *parsetree, */ if (rc != NULL) markQueryForLocking(rule_action, (Node *) rule_action->jointree, - rc->forUpdate, rc->noWait, true); + rc->strength, rc->noWait, true); return parsetree; } /* - * Recursively mark all relations used by a view as FOR UPDATE/SHARE. + * Recursively mark all relations used by a view as FOR [KEY] UPDATE/SHARE. * * This may generate an invalid query, eg if some sub-query uses an * aggregate. We leave it to the planner to detect that. @@ -1432,7 +1432,7 @@ ApplyRetrieveRule(Query *parsetree, */ static void markQueryForLocking(Query *qry, Node *jtnode, - bool forUpdate, bool noWait, bool pushedDown) + LockClauseStrength strength, bool noWait, bool pushedDown) { if (jtnode == NULL) return; @@ -1446,16 +1446,16 @@ markQueryForLocking(Query *qry, Node *jtnode, /* ignore foreign tables */ if (rte->relkind != RELKIND_FOREIGN_TABLE) { - applyLockingClause(qry, rti, forUpdate, noWait, pushedDown); + applyLockingClause(qry, rti, strength, noWait, pushedDown); rte->requiredPerms |= ACL_SELECT_FOR_UPDATE; } } else if (rte->rtekind == RTE_SUBQUERY) { - applyLockingClause(qry, rti, forUpdate, noWait, pushedDown); - /* FOR UPDATE/SHARE of subquery is propagated to subquery's rels */ + applyLockingClause(qry, rti, strength, noWait, pushedDown); + /* FOR [KEY] UPDATE/SHARE of subquery is propagated to subquery's rels */ markQueryForLocking(rte->subquery, (Node *) rte->subquery->jointree, - forUpdate, noWait, true); + strength, noWait, true); } /* other RTE types are unaffected by FOR UPDATE */ } @@ -1465,14 +1465,14 @@ markQueryForLocking(Query *qry, Node *jtnode, ListCell *l; foreach(l, f->fromlist) - markQueryForLocking(qry, lfirst(l), forUpdate, noWait, pushedDown); + markQueryForLocking(qry, lfirst(l), strength, noWait, pushedDown); } else if (IsA(jtnode, JoinExpr)) { JoinExpr *j = (JoinExpr *) jtnode; - markQueryForLocking(qry, j->larg, forUpdate, noWait, pushedDown); - markQueryForLocking(qry, j->rarg, forUpdate, noWait, pushedDown); + markQueryForLocking(qry, j->larg, strength, noWait, pushedDown); + markQueryForLocking(qry, j->rarg, strength, noWait, pushedDown); } else elog(ERROR, "unrecognized node type: %d", |