mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Improve representation of PlanRowMark.
This patch fixes two inadequacies of the PlanRowMark representation. First, that the original LockingClauseStrength isn't stored (and cannot be inferred for foreign tables, which always get ROW_MARK_COPY). Since some PlanRowMarks are created out of whole cloth and don't actually have an ancestral RowMarkClause, this requires adding a dummy LCS_NONE value to enum LockingClauseStrength, which is fairly annoying but the alternatives seem worse. This fix allows getting rid of the use of get_parse_rowmark() in FDWs (as per the discussion around commits462bd95705
and8ec8760fc8
), and it simplifies some things elsewhere. Second, that the representation assumed that all child tables in an inheritance hierarchy would use the same RowMarkType. That's true today but will soon not be true. We add an "allMarkTypes" field that identifies the union of mark types used in all a parent table's children, and use that where appropriate (currently, only in preprocess_targetlist()). In passing fix a couple of minor infelicities left over from the SKIP LOCKED patch, notably that _outPlanRowMark still thought waitPolicy is a bool. Catversion bump is required because the numeric values of enum LockingClauseStrength can appear in on-disk rules. Extracted from a much larger patch to support foreign table inheritance; it seemed worth breaking this out, since it's a separable concern. Shigeru Hanada and Etsuro Fujita, somewhat modified by me
This commit is contained in:
@@ -2395,26 +2395,22 @@ CreateCommandTag(Node *parsetree)
|
||||
else if (stmt->rowMarks != NIL)
|
||||
{
|
||||
/* not 100% but probably close enough */
|
||||
switch (((PlanRowMark *) linitial(stmt->rowMarks))->markType)
|
||||
switch (((PlanRowMark *) linitial(stmt->rowMarks))->strength)
|
||||
{
|
||||
case ROW_MARK_EXCLUSIVE:
|
||||
tag = "SELECT FOR UPDATE";
|
||||
break;
|
||||
case ROW_MARK_NOKEYEXCLUSIVE:
|
||||
tag = "SELECT FOR NO KEY UPDATE";
|
||||
break;
|
||||
case ROW_MARK_SHARE:
|
||||
tag = "SELECT FOR SHARE";
|
||||
break;
|
||||
case ROW_MARK_KEYSHARE:
|
||||
case LCS_FORKEYSHARE:
|
||||
tag = "SELECT FOR KEY SHARE";
|
||||
break;
|
||||
case ROW_MARK_REFERENCE:
|
||||
case ROW_MARK_COPY:
|
||||
tag = "SELECT";
|
||||
case LCS_FORSHARE:
|
||||
tag = "SELECT FOR SHARE";
|
||||
break;
|
||||
case LCS_FORNOKEYUPDATE:
|
||||
tag = "SELECT FOR NO KEY UPDATE";
|
||||
break;
|
||||
case LCS_FORUPDATE:
|
||||
tag = "SELECT FOR UPDATE";
|
||||
break;
|
||||
default:
|
||||
tag = "???";
|
||||
tag = "SELECT";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user