2000-01-05 18:32:18 +01:00
|
|
|
--
|
|
|
|
-- CREATE_FUNCTION_1
|
|
|
|
--
|
2002-08-22 02:01:51 +02:00
|
|
|
CREATE FUNCTION widget_in(cstring)
|
1997-04-27 04:58:38 +02:00
|
|
|
RETURNS widget
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C STRICT;
|
2003-07-28 02:09:16 +02:00
|
|
|
NOTICE: type "widget" is not yet defined
|
2003-07-19 01:20:33 +02:00
|
|
|
DETAIL: Creating a shell type definition.
|
2002-08-22 02:01:51 +02:00
|
|
|
CREATE FUNCTION widget_out(widget)
|
|
|
|
RETURNS cstring
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C STRICT;
|
2003-07-19 01:20:33 +02:00
|
|
|
NOTICE: argument type widget is only a shell
|
2002-08-22 02:01:51 +02:00
|
|
|
CREATE FUNCTION int44in(cstring)
|
|
|
|
RETURNS city_budget
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C STRICT;
|
2003-07-28 02:09:16 +02:00
|
|
|
NOTICE: type "city_budget" is not yet defined
|
2003-07-19 01:20:33 +02:00
|
|
|
DETAIL: Creating a shell type definition.
|
2002-08-22 02:01:51 +02:00
|
|
|
CREATE FUNCTION int44out(city_budget)
|
|
|
|
RETURNS cstring
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C STRICT;
|
2003-07-19 01:20:33 +02:00
|
|
|
NOTICE: argument type city_budget is only a shell
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION check_primary_key ()
|
2002-08-22 02:01:51 +02:00
|
|
|
RETURNS trigger
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/refint@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION check_foreign_key ()
|
2002-08-22 02:01:51 +02:00
|
|
|
RETURNS trigger
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/refint@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION autoinc ()
|
2002-08-22 02:01:51 +02:00
|
|
|
RETURNS trigger
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/autoinc@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION funny_dup17 ()
|
2002-08-22 02:01:51 +02:00
|
|
|
RETURNS trigger
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION ttdummy ()
|
2002-08-22 02:01:51 +02:00
|
|
|
RETURNS trigger
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION set_ttdummy (int4)
|
1997-09-24 10:36:47 +02:00
|
|
|
RETURNS int4
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C STRICT;
|
2013-07-02 19:35:14 +02:00
|
|
|
CREATE FUNCTION make_tuple_indirect (record)
|
|
|
|
RETURNS record
|
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
|
|
|
LANGUAGE C STRICT;
|
2002-05-22 19:21:02 +02:00
|
|
|
-- Things that shouldn't work:
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
|
2002-05-22 19:21:02 +02:00
|
|
|
AS 'SELECT ''not an integer'';';
|
2003-07-19 01:20:33 +02:00
|
|
|
ERROR: return type mismatch in function declared to return integer
|
2007-06-18 23:40:58 +02:00
|
|
|
DETAIL: Actual return type is unknown.
|
2004-03-14 02:58:41 +01:00
|
|
|
CONTEXT: SQL function "test1"
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
|
2002-05-22 19:21:02 +02:00
|
|
|
AS 'not even SQL';
|
2006-03-14 23:48:25 +01:00
|
|
|
ERROR: syntax error at or near "not"
|
2004-03-21 23:29:11 +01:00
|
|
|
LINE 2: AS 'not even SQL';
|
|
|
|
^
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
|
2002-05-22 19:21:02 +02:00
|
|
|
AS 'SELECT 1, 2, 3;';
|
2003-07-19 01:20:33 +02:00
|
|
|
ERROR: return type mismatch in function declared to return integer
|
2008-10-31 20:37:56 +01:00
|
|
|
DETAIL: Final statement must return exactly one column.
|
2004-03-14 02:58:41 +01:00
|
|
|
CONTEXT: SQL function "test1"
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
|
2002-05-22 19:21:02 +02:00
|
|
|
AS 'SELECT $2;';
|
2003-07-19 01:20:33 +02:00
|
|
|
ERROR: there is no parameter $2
|
2008-09-01 22:42:46 +02:00
|
|
|
LINE 2: AS 'SELECT $2;';
|
|
|
|
^
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL
|
2002-05-22 19:21:02 +02:00
|
|
|
AS 'a', 'b';
|
2003-07-19 01:20:33 +02:00
|
|
|
ERROR: only one AS item needed for language "sql"
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
|
2002-05-22 19:21:02 +02:00
|
|
|
AS 'nosuchfile';
|
2003-07-19 01:20:33 +02:00
|
|
|
ERROR: could not access file "nosuchfile": No such file or directory
|
2006-02-27 17:09:50 +01:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@', 'nosuchsymbol';
|
|
|
|
ERROR: could not find function "nosuchsymbol" in file "@libdir@/regress@DLSUFFIX@"
|
2002-05-22 19:21:02 +02:00
|
|
|
CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal
|
|
|
|
AS 'nosuch';
|
|
|
|
ERROR: there is no built-in function named "nosuch"
|