pgsql: Replace SQLValueFunction by COERCE_SQL_SYNTAX - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Replace SQLValueFunction by COERCE_SQL_SYNTAX
Date
Msg-id E1ox3AR-000C4x-AR@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f193883fc9cebe8fa20359b0797832837a788112

Modified Files
--------------
src/backend/catalog/system_functions.sql  | 26 +++++++++
src/backend/executor/execExpr.c           | 11 ----
src/backend/executor/execExprInterp.c     | 46 ----------------
src/backend/jit/llvm/llvmjit_expr.c       |  6 --
src/backend/jit/llvm/llvmjit_types.c      |  1 -
src/backend/nodes/nodeFuncs.c             | 27 ++-------
src/backend/optimizer/path/costsize.c     |  1 -
src/backend/optimizer/util/clauses.c      | 39 +++----------
src/backend/parser/gram.y                 | 59 ++++++++++++--------
src/backend/parser/parse_expr.c           | 52 -----------------
src/backend/parser/parse_target.c         | 25 ---------
src/backend/utils/adt/date.c              | 81 ++++++++++++++++-----------
src/backend/utils/adt/ruleutils.c         | 92 ++++++++++++++++---------------
src/backend/utils/adt/timestamp.c         | 72 ++++++++++++++----------
src/backend/utils/misc/queryjumble.c      |  9 ---
src/include/catalog/catversion.h          |  2 +-
src/include/catalog/pg_proc.dat           | 17 ++++++
src/include/executor/execExpr.h           |  8 ---
src/include/nodes/primnodes.h             | 33 -----------
src/include/utils/date.h                  |  4 --
src/include/utils/timestamp.h             |  4 --
src/test/regress/expected/expressions.out |  2 +-
src/test/regress/sql/expressions.sql      |  2 +-
src/tools/pgindent/typedefs.list          |  2 -
24 files changed, 231 insertions(+), 390 deletions(-)


pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Add additional checks while creating the initial decoding snapsh
Next
From: Tom Lane
Date:
Subject: pgsql: Prevent instability in contrib/pageinspect's regression test.