diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2025-04-03 16:03:06 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2025-04-03 16:03:12 -0400 |
commit | dbd437e670b88ca67f6b2477e853412a0e82a8cc (patch) | |
tree | addd72e99f1262b338e9d0f33f826a5fd024af6f /src/test/regress/sql/create_function_sql.sql | |
parent | 46c4c7cbc6d562d5f1b784fea9527c998c190b99 (diff) | |
download | postgresql-dbd437e670b88ca67f6b2477e853412a0e82a8cc.tar.gz postgresql-dbd437e670b88ca67f6b2477e853412a0e82a8cc.zip |
Fix oversight in commit 0dca5d68d.
As coded, fmgr_sql() would get an assertion failure for a SQL function
that has an empty body and is declared to return some type other than
VOID. Typically you'd never get that far because fmgr_sql_validator()
would reject such a definition (I suspect that's how come I managed to
miss the bug). But if check_function_bodies is off or the function is
polymorphic, the validation check wouldn't get made.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/0fde377a-3870-4d18-946a-ce008ee5bb88@gmail.com
Diffstat (limited to 'src/test/regress/sql/create_function_sql.sql')
-rw-r--r-- | src/test/regress/sql/create_function_sql.sql | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/regress/sql/create_function_sql.sql b/src/test/regress/sql/create_function_sql.sql index 68776be4c8d..6d1c102d780 100644 --- a/src/test/regress/sql/create_function_sql.sql +++ b/src/test/regress/sql/create_function_sql.sql @@ -449,6 +449,16 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL AS 'a', 'b'; +CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL + AS ''; + +-- make sure empty-body case is handled at execution time, too +SET check_function_bodies = off; +CREATE FUNCTION test1 (anyelement) RETURNS anyarray LANGUAGE SQL + AS ''; +SELECT test1(0); +RESET check_function_bodies; + -- Cleanup DROP SCHEMA temp_func_test CASCADE; DROP USER regress_unpriv_user; |