aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/input/create_function_1.source
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2002-05-22 17:21:02 +0000
committerPeter Eisentraut <peter_e@gmx.net>2002-05-22 17:21:02 +0000
commitd60f10b0e74173653d17c09750a791afe6f56404 (patch)
tree9803f14bc9ce71e3a056a447b6999847bb2a8dd6 /src/test/regress/input/create_function_1.source
parentdf9c8e1a39dc0502c62e164aa94e7e810bcd2009 (diff)
downloadpostgresql-d60f10b0e74173653d17c09750a791afe6f56404.tar.gz
postgresql-d60f10b0e74173653d17c09750a791afe6f56404.zip
Add optional "validator" function to languages that can validate the
function body (and other properties) as a function in the language is created. This generalizes ad hoc code that already existed for the built-in languages. The validation now happens after the pg_proc tuple of the new function is created, so it is possible to define recursive SQL functions. Add some regression test cases that cover bogus function definition attempts.
Diffstat (limited to 'src/test/regress/input/create_function_1.source')
-rw-r--r--src/test/regress/input/create_function_1.source25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/regress/input/create_function_1.source b/src/test/regress/input/create_function_1.source
index 6d91674cd56..14ae6ff2bbb 100644
--- a/src/test/regress/input/create_function_1.source
+++ b/src/test/regress/input/create_function_1.source
@@ -42,3 +42,28 @@ CREATE FUNCTION set_ttdummy (int4)
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'C';
+-- 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';
+
+CREATE FUNCTION test1 (int) RETURNS int LANGUAGE c
+ AS '@abs_builddir@/regress@DLSUFFIX@', 'nosuchsymbol';
+
+CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
+ AS 'nosuch';