v6_to_v7_changes.diff
text/plain
Patch
Format: unified
Series: patch v6
| File | + | − |
|---|---|---|
| src/backend/executor/execMain.c | 2 | 2 |
| src/backend/executor/execUtils.c | 3 | 2 |
| src/backend/parser/parse_relation.c | 4 | 2 |
| src/include/nodes/parsenodes.h | 4 | 1 |
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 2ca25d857d..d895ed29d1 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -841,8 +841,8 @@ InitPlan(QueryDesc *queryDesc, int eflags)
/*
* Allocate an array to store open Relations of each rangeTable item. We
- * 0 fill this for now. The Relations are only opened and stored here the
- * first time they're required during node initialization.
+ * zero-fill this for now. The Relations are only opened and stored here
+ * the first time they're required during node initialization.
*/
estate->es_relations = (Relation *) palloc0(estate->es_range_table_size *
sizeof(Relation));
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index ab46fd425d..bd306d0389 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -994,8 +994,9 @@ ExecInitRangeTable(EState *estate, List *rangeTable)
if (rte->rtekind == RTE_RELATION && OidIsValid(rte->relid))
{
/*
- * The following asserts that no new lock needed to be taken,
- * meaning the upstream code already acquired the needed locks.
+ * The following asserts that the necessary lock on the relation
+ * has already been taken. That can only however be true in the
+ * parallel leader.
*/
Assert(rte->lockmode != NoLock);
if (!IsParallelWorker() &&
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index a9cfd1f67b..cbee07aeb8 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -1283,8 +1283,10 @@ addRangeTableEntryForRelation(ParseState *pstate,
Assert(pstate != NULL);
#ifdef USE_ASSERT_CHECKING
- if (lockmode != NoLock && !CheckRelationLockedByUs(RelationGetRelid(rel), lockmode))
- elog(WARNING, "lock on \"%s\" is not held", RelationGetRelationName(rel));
+ if (lockmode != NoLock &&
+ !CheckRelationLockedByUs(RelationGetRelid(rel), lockmode))
+ elog(WARNING, "lock on \"%s\" is not held",
+ RelationGetRelationName(rel));
#endif
rte->rtekind = RTE_RELATION;
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index d844e323f0..2a265d591d 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -977,7 +977,10 @@ typedef struct RangeTblEntry
*/
Oid relid; /* OID of the relation */
char relkind; /* relation kind (see pg_class.relkind) */
- LOCKMODE lockmode; /* lock level to obtain on the relation */
+ LOCKMODE lockmode; /* lock level to obtain on the relation; must
+ * be non-zero for all plain relation RTEs
+ * that will be passed to the executor via
+ * PlannedStmt. */
struct TableSampleClause *tablesample; /* sampling info, or NULL */
/*