summaryrefslogtreecommitdiffstats
path: root/src/test/regress/sql/create_function_c.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:17:33 +0000
commit5e45211a64149b3c659b90ff2de6fa982a5a93ed (patch)
tree739caf8c461053357daa9f162bef34516c7bf452 /src/test/regress/sql/create_function_c.sql
parentInitial commit. (diff)
downloadpostgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.tar.xz
postgresql-15-5e45211a64149b3c659b90ff2de6fa982a5a93ed.zip
Adding upstream version 15.5.upstream/15.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/regress/sql/create_function_c.sql')
-rw-r--r--src/test/regress/sql/create_function_c.sql35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/regress/sql/create_function_c.sql b/src/test/regress/sql/create_function_c.sql
new file mode 100644
index 0000000..2e5a390
--- /dev/null
+++ b/src/test/regress/sql/create_function_c.sql
@@ -0,0 +1,35 @@
+--
+-- CREATE_FUNCTION_C
+--
+-- This script used to create C functions for other scripts to use.
+-- But to get rid of the ordering dependencies that caused, such
+-- functions are now made either in test_setup.sql or in the specific
+-- test script that needs them. All that remains here is error cases.
+
+-- directory path and dlsuffix are passed to us in environment variables
+\getenv libdir PG_LIBDIR
+\getenv dlsuffix PG_DLSUFFIX
+
+\set regresslib :libdir '/regress' :dlsuffix
+
+--
+-- Check LOAD command. (The alternative of implicitly loading the library
+-- is checked in many other test scripts.)
+--
+LOAD :'regresslib';
+
+-- Things that shouldn't work:
+
+CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
+ AS 'nosuchfile';
+
+-- To produce stable regression test output, we have to filter the name
+-- of the regresslib file out of the error message in this test.
+\set VERBOSITY sqlstate
+CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
+ AS :'regresslib', 'nosuchsymbol';
+\set VERBOSITY default
+SELECT regexp_replace(:'LAST_ERROR_MESSAGE', 'file ".*"', 'file "..."');
+
+CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
+ AS 'nosuch';