diff options
Diffstat (limited to 'src/backend/optimizer/util')
-rw-r--r-- | src/backend/optimizer/util/clauses.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 8961ed88a81..8b4425dcf90 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -902,6 +902,12 @@ contain_mutable_functions_walker(Node *node, void *context) return true; } + if (IsA(node, NextValueExpr)) + { + /* NextValueExpr is volatile */ + return true; + } + /* * It should be safe to treat MinMaxExpr as immutable, because it will * depend on a non-cross-type btree comparison function, and those should @@ -969,6 +975,12 @@ contain_volatile_functions_walker(Node *node, void *context) context)) return true; + if (IsA(node, NextValueExpr)) + { + /* NextValueExpr is volatile */ + return true; + } + /* * See notes in contain_mutable_functions_walker about why we treat * MinMaxExpr, XmlExpr, and CoerceToDomain as immutable, while @@ -1019,6 +1031,8 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context) * See notes in contain_mutable_functions_walker about why we treat * MinMaxExpr, XmlExpr, and CoerceToDomain as immutable, while * SQLValueFunction is stable. Hence, none of them are of interest here. + * Also, since we're intentionally ignoring nextval(), presumably we + * should ignore NextValueExpr. */ /* Recurse to check arguments */ @@ -1146,7 +1160,7 @@ max_parallel_hazard_walker(Node *node, max_parallel_hazard_context *context) * contain a parallel-unsafe function; but useful constraints probably * never would have such, and assuming they do would cripple use of * parallel query in the presence of domain types.) SQLValueFunction - * should be safe in all cases. + * should be safe in all cases. NextValueExpr is parallel-unsafe. */ if (IsA(node, CoerceToDomain)) { @@ -1154,6 +1168,12 @@ max_parallel_hazard_walker(Node *node, max_parallel_hazard_context *context) return true; } + if (IsA(node, NextValueExpr)) + { + if (max_parallel_hazard_test(PROPARALLEL_UNSAFE, context)) + return true; + } + /* * As a notational convenience for callers, look through RestrictInfo. */ @@ -1495,6 +1515,7 @@ contain_leaked_vars_walker(Node *node, void *context) case T_SQLValueFunction: case T_NullTest: case T_BooleanTest: + case T_NextValueExpr: case T_List: /* |