summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/create_function_0.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-02-08 15:30:38 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-02-08 15:30:38 -0500
commitcc50080a828dd4791b43539f5a0f976e535d147c (patch)
tree787184da35163d8be525b7f84af85083e50d152a /src/test/regress/sql/create_function_0.sql
parentba15f16107bea8a93edc505f3013cd7df4ac90fc (diff)
Rearrange core regression tests to reduce cross-script dependencies.
The idea behind this patch is to make it possible to run individual test scripts without running the entire core test suite. Making all the scripts completely independent would involve a massive rewrite, and would probably be worse for coverage of things like concurrent DDL. So this patch just does what seems practical with limited changes. The net effect is that any test script can be run after running limited earlier dependencies: * all scripts depend on test_setup * many scripts depend on create_index * other dependencies are few in number, and are documented in the parallel_schedule file. To accomplish this, I chose a small number of commonly-used tables and moved their creation and filling into test_setup. Later scripts are expected not to modify these tables' data contents, for fear of affecting other scripts' results. Also, our former habit of declaring all C functions in one place is now gone in favor of declaring them where they're used, if that's just one script, or in test_setup if necessary. There's more that could be done to remove some of the remaining inter-script dependencies, but significantly more-invasive changes would be needed, and at least for now it doesn't seem worth it. Discussion: https://postgr.es/m/1114748.1640383217@sss.pgh.pa.us
Diffstat (limited to 'src/test/regress/sql/create_function_0.sql')
-rw-r--r--src/test/regress/sql/create_function_0.sql91
1 files changed, 9 insertions, 82 deletions
diff --git a/src/test/regress/sql/create_function_0.sql b/src/test/regress/sql/create_function_0.sql
index c5224742f94..54da95f2494 100644
--- a/src/test/regress/sql/create_function_0.sql
+++ b/src/test/regress/sql/create_function_0.sql
@@ -1,98 +1,25 @@
--
-- CREATE_FUNCTION_0
--
+-- 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 autoinclib :libdir '/autoinc' :dlsuffix
-\set refintlib :libdir '/refint' :dlsuffix
\set regresslib :libdir '/regress' :dlsuffix
--- Create a bunch of C functions that will be used by later tests:
-
-CREATE FUNCTION check_primary_key ()
- RETURNS trigger
- AS :'refintlib'
- LANGUAGE C;
-
-CREATE FUNCTION check_foreign_key ()
- RETURNS trigger
- AS :'refintlib'
- LANGUAGE C;
-
-CREATE FUNCTION autoinc ()
- RETURNS trigger
- AS :'autoinclib'
- LANGUAGE C;
-
-CREATE FUNCTION trigger_return_old ()
- RETURNS trigger
- AS :'regresslib'
- LANGUAGE C;
-
-CREATE FUNCTION ttdummy ()
- RETURNS trigger
- AS :'regresslib'
- LANGUAGE C;
-
-CREATE FUNCTION set_ttdummy (int4)
- RETURNS int4
- AS :'regresslib'
- LANGUAGE C STRICT;
-
-CREATE FUNCTION make_tuple_indirect (record)
- RETURNS record
- AS :'regresslib'
- LANGUAGE C STRICT;
-
-CREATE FUNCTION test_atomic_ops()
- RETURNS bool
- AS :'regresslib'
- LANGUAGE C;
-
-CREATE FUNCTION test_fdw_handler()
- RETURNS fdw_handler
- AS :'regresslib', 'test_fdw_handler'
- LANGUAGE C;
-
-CREATE FUNCTION test_support_func(internal)
- RETURNS internal
- AS :'regresslib', 'test_support_func'
- LANGUAGE C STRICT;
-
-CREATE FUNCTION test_opclass_options_func(internal)
- RETURNS void
- AS :'regresslib', 'test_opclass_options_func'
- LANGUAGE C;
-
-CREATE FUNCTION test_enc_conversion(bytea, name, name, bool, validlen OUT int, result OUT bytea)
- AS :'regresslib', 'test_enc_conversion'
- LANGUAGE C STRICT;
-
-CREATE FUNCTION binary_coercible(oid, oid)
- RETURNS bool
- AS :'regresslib', 'binary_coercible'
- LANGUAGE C STRICT STABLE PARALLEL SAFE;
+--
+-- 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 SQL
- AS 'SELECT ''not an integer'';';
-
-CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
- AS 'not even SQL';
-
-CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
- AS 'SELECT 1, 2, 3;';
-
-CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
- AS 'SELECT $2;';
-
-CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
- AS 'a', 'b';
-
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
AS 'nosuchfile';