diff options
author | Michael Paquier <michael@paquier.xyz> | 2022-11-21 18:31:59 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2022-11-21 18:31:59 +0900 |
commit | f193883fc9cebe8fa20359b0797832837a788112 (patch) | |
tree | b53cd2d5a291d6d7ec546ca645901c4ee4334fe9 /src/backend/nodes/nodeFuncs.c | |
parent | 240e0dbacd390a8465552e27c5af11f67d747adb (diff) | |
download | postgresql-f193883fc9cebe8fa20359b0797832837a788112.tar.gz postgresql-f193883fc9cebe8fa20359b0797832837a788112.zip |
Replace SQLValueFunction by COERCE_SQL_SYNTAX
This switch impacts 9 patterns related to a SQL-mandated special syntax
for function calls:
- LOCALTIME [ ( typmod ) ]
- LOCALTIMESTAMP [ ( typmod ) ]
- CURRENT_TIME [ ( typmod ) ]
- CURRENT_TIMESTAMP [ ( typmod ) ]
- CURRENT_DATE
Five new entries are added to pg_proc to compensate the removal of
SQLValueFunction to provide backward-compatibility and making this
change transparent for the end-user (for example for the attribute
generated when a keyword is specified in a SELECT or in a FROM clause
without an alias, or when specifying something else than an Iconst to
the parser).
The parser included a set of checks coming from the files in charge of
holding the C functions used for the SQLValueFunction calls (as of
transformSQLValueFunction()), which are now moved within each function's
execution path, so this reduces the dependencies between the execution
and the parsing steps. As of this change, all the SQL keywords use the
same paths for their work, relying only on COERCE_SQL_SYNTAX. Like
fb32748, no performance difference has been noticed, while the perf
profiles get reduced with ExecEvalSQLValueFunction() gone.
Bump catalog version.
Reviewed-by: Corey Huinker, Ted Yu
Discussion: https://postgr.es/m/YzaG3MoryCguUOym@paquier.xyz
Diffstat (limited to 'src/backend/nodes/nodeFuncs.c')
-rw-r--r-- | src/backend/nodes/nodeFuncs.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 2585a3175c9..af8620ceb7c 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -210,9 +210,6 @@ exprType(const Node *expr) case T_MinMaxExpr: type = ((const MinMaxExpr *) expr)->minmaxtype; break; - case T_SQLValueFunction: - type = ((const SQLValueFunction *) expr)->type; - break; case T_XmlExpr: if (((const XmlExpr *) expr)->op == IS_DOCUMENT) type = BOOLOID; @@ -474,8 +471,6 @@ exprTypmod(const Node *expr) return typmod; } break; - case T_SQLValueFunction: - return ((const SQLValueFunction *) expr)->typmod; case T_CoerceToDomain: return ((const CoerceToDomain *) expr)->resulttypmod; case T_CoerceToDomainValue: @@ -916,10 +911,6 @@ exprCollation(const Node *expr) case T_MinMaxExpr: coll = ((const MinMaxExpr *) expr)->minmaxcollid; break; - case T_SQLValueFunction: - /* Returns a non-collatable type */ - coll = InvalidOid; - break; case T_XmlExpr: /* @@ -1140,9 +1131,6 @@ exprSetCollation(Node *expr, Oid collation) case T_MinMaxExpr: ((MinMaxExpr *) expr)->minmaxcollid = collation; break; - case T_SQLValueFunction: - Assert(collation == InvalidOid); - break; case T_XmlExpr: Assert((((XmlExpr *) expr)->op == IS_XMLSERIALIZE) ? (collation == DEFAULT_COLLATION_OID) : @@ -1426,10 +1414,6 @@ exprLocation(const Node *expr) /* GREATEST/LEAST keyword should always be the first thing */ loc = ((const MinMaxExpr *) expr)->location; break; - case T_SQLValueFunction: - /* function keyword should always be the first thing */ - loc = ((const SQLValueFunction *) expr)->location; - break; case T_XmlExpr: { const XmlExpr *xexpr = (const XmlExpr *) expr; @@ -1717,10 +1701,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, 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. + * Note: we ignore MinMaxExpr, 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, @@ -1936,7 +1920,6 @@ expression_tree_walker_impl(Node *node, case T_Const: case T_Param: case T_CaseTestExpr: - case T_SQLValueFunction: case T_CoerceToDomainValue: case T_SetToDefault: case T_CurrentOfExpr: @@ -2673,7 +2656,6 @@ expression_tree_mutator_impl(Node *node, break; case T_Param: case T_CaseTestExpr: - case T_SQLValueFunction: case T_CoerceToDomainValue: case T_SetToDefault: case T_CurrentOfExpr: @@ -3587,7 +3569,6 @@ raw_expression_tree_walker_impl(Node *node, { case T_SetToDefault: case T_CurrentOfExpr: - case T_SQLValueFunction: case T_Integer: case T_Float: case T_Boolean: |