diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-07-14 15:25:43 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-07-14 15:25:43 -0400 |
commit | decb08ebdf07f2fea4b6bb43380366ef5defbafb (patch) | |
tree | 8df1e4ed94f556acbf1cdf99a7344f8dda474f27 /src/backend/nodes/nodeFuncs.c | |
parent | c95275fc202c231e867d2f0a00e8d18621b67f0d (diff) | |
download | postgresql-decb08ebdf07f2fea4b6bb43380366ef5defbafb.tar.gz postgresql-decb08ebdf07f2fea4b6bb43380366ef5defbafb.zip |
Code review for NextValueExpr expression node type.
Add missing infrastructure for this node type, notably in ruleutils.c where
its lack could demonstrably cause EXPLAIN to fail. Add outfuncs/readfuncs
support. (outfuncs support is useful today for debugging purposes. The
readfuncs support may never be needed, since at present it would only
matter for parallel query and NextValueExpr should never appear in a
parallelizable query; but it seems like a bad idea to have a primnode type
that isn't fully supported here.) Teach planner infrastructure that
NextValueExpr is a volatile, parallel-unsafe, non-leaky expression node
with cost cpu_operator_cost. Given its limited scope of usage, there
*might* be no live bug today from the lack of that knowledge, but it's
certainly going to bite us on the rear someday. Teach pg_stat_statements
about the new node type, too.
While at it, also teach cost_qual_eval() that MinMaxExpr, SQLValueFunction,
XmlExpr, and CoerceToDomain should be charged as cpu_operator_cost.
Failing to do this for SQLValueFunction was an oversight in my commit
0bb51aa96. The others are longer-standing oversights, but no time like the
present to fix them. (In principle, CoerceToDomain could have cost much
higher than this, but it doesn't presently seem worth trying to examine the
domain's constraints here.)
Modify execExprInterp.c to execute NextValueExpr as an out-of-line
function; it seems quite unlikely to me that it's worth insisting that
it be inlined in all expression eval methods. Besides, providing the
out-of-line function doesn't stop anyone from inlining if they want to.
Adjust some places where NextValueExpr support had been inserted with the
aid of a dartboard rather than keeping it in the same order as elsewhere.
Discussion: https://postgr.es/m/23862.1499981661@sss.pgh.pa.us
Diffstat (limited to 'src/backend/nodes/nodeFuncs.c')
-rw-r--r-- | src/backend/nodes/nodeFuncs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 97ba25fc72c..e3eb0c57887 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -1642,10 +1642,10 @@ set_sa_opfuncid(ScalarArrayOpExpr *opexpr) * for themselves, in case additional checks should be made, or because they * have special rules about which parts of the tree need to be visited. * - * Note: we ignore MinMaxExpr, SQLValueFunction, XmlExpr, and CoerceToDomain - * nodes, because they do not contain SQL function OIDs. However, they can - * invoke SQL-visible functions, so callers should take thought about how to - * treat them. + * Note: we ignore MinMaxExpr, SQLValueFunction, XmlExpr, CoerceToDomain, + * and NextValueExpr nodes, because they do not contain SQL function OIDs. + * However, they can invoke SQL-visible functions, so callers should take + * thought about how to treat them. */ bool check_functions_in_node(Node *node, check_function_callback checker, @@ -1865,12 +1865,12 @@ expression_tree_walker(Node *node, case T_Var: case T_Const: case T_Param: - case T_CoerceToDomainValue: case T_CaseTestExpr: + case T_SQLValueFunction: + case T_CoerceToDomainValue: case T_SetToDefault: case T_CurrentOfExpr: case T_NextValueExpr: - case T_SQLValueFunction: case T_RangeTblRef: case T_SortGroupClause: /* primitive node types with no expression subnodes */ @@ -2461,12 +2461,12 @@ expression_tree_mutator(Node *node, } break; case T_Param: - case T_CoerceToDomainValue: case T_CaseTestExpr: + case T_SQLValueFunction: + case T_CoerceToDomainValue: case T_SetToDefault: case T_CurrentOfExpr: case T_NextValueExpr: - case T_SQLValueFunction: case T_RangeTblRef: case T_SortGroupClause: return (Node *) copyObject(node); |