2021-05-11 20:28:11 +02:00
|
|
|
--
|
2022-02-08 21:40:08 +01:00
|
|
|
-- CREATE_FUNCTION_C
|
2021-05-11 20:28:11 +02:00
|
|
|
--
|
2022-02-08 21:30:38 +01:00
|
|
|
-- 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.
|
2021-12-20 20:06:15 +01:00
|
|
|
-- directory path and dlsuffix are passed to us in environment variables
|
|
|
|
\getenv libdir PG_LIBDIR
|
|
|
|
\getenv dlsuffix PG_DLSUFFIX
|
|
|
|
\set regresslib :libdir '/regress' :dlsuffix
|
2022-02-08 21:30:38 +01:00
|
|
|
--
|
|
|
|
-- Check LOAD command. (The alternative of implicitly loading the library
|
|
|
|
-- is checked in many other test scripts.)
|
|
|
|
--
|
|
|
|
LOAD :'regresslib';
|
2021-05-11 20:28:11 +02:00
|
|
|
-- Things that shouldn't work:
|
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
|
|
|
|
AS 'nosuchfile';
|
|
|
|
ERROR: could not access file "nosuchfile": No such file or directory
|
2021-12-20 20:06:15 +01:00
|
|
|
-- 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
|
2021-05-11 20:28:11 +02:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
|
2021-12-20 20:06:15 +01:00
|
|
|
AS :'regresslib', 'nosuchsymbol';
|
|
|
|
ERROR: 42883
|
|
|
|
\set VERBOSITY default
|
|
|
|
SELECT regexp_replace(:'LAST_ERROR_MESSAGE', 'file ".*"', 'file "..."');
|
|
|
|
regexp_replace
|
|
|
|
------------------------------------------------------
|
|
|
|
could not find function "nosuchsymbol" in file "..."
|
|
|
|
(1 row)
|
|
|
|
|
2021-05-11 20:28:11 +02:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
|
|
|
|
AS 'nosuch';
|
|
|
|
ERROR: there is no built-in function named "nosuch"
|