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/catalog/system_functions.sql | |
| parent | 240e0dbacd390a8465552e27c5af11f67d747adb (diff) | |
| download | postgresql-f193883fc9cebe8fa20359b0797832837a788112.tar.gz | |
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/catalog/system_functions.sql')
| -rw-r--r-- | src/backend/catalog/system_functions.sql | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/backend/catalog/system_functions.sql b/src/backend/catalog/system_functions.sql index 30a048f6b0..52517a6531 100644 --- a/src/backend/catalog/system_functions.sql +++ b/src/backend/catalog/system_functions.sql @@ -594,6 +594,32 @@ LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE AS 'unicode_is_normalized'; +-- Functions with SQL-mandated special syntax and some defaults. +CREATE OR REPLACE FUNCTION + "current_time"(int4 DEFAULT NULL) + RETURNS timetz + LANGUAGE internal + STABLE PARALLEL SAFE +AS 'current_time'; +CREATE OR REPLACE FUNCTION + "current_timestamp"(int4 DEFAULT NULL) + RETURNS timestamptz + LANGUAGE internal + STABLE PARALLEL SAFE + AS 'current_timestamp'; +CREATE OR REPLACE FUNCTION + "localtime"(int4 DEFAULT NULL) + RETURNS time + LANGUAGE internal + STABLE PARALLEL SAFE + AS 'sql_localtime'; +CREATE OR REPLACE FUNCTION + "localtimestamp"(int4 DEFAULT NULL) + RETURNS timestamp + LANGUAGE internal + STABLE PARALLEL SAFE + AS 'sql_localtimestamp'; + -- -- The default permissions for functions mean that anyone can execute them. -- A number of functions shouldn't be executable by just anyone, but rather |
