2000-01-05 18:32:18 +01:00
|
|
|
--
|
|
|
|
-- CREATE_FUNCTION_2
|
|
|
|
--
|
|
|
|
CREATE FUNCTION hobbies(person)
|
2010-11-23 21:27:50 +01:00
|
|
|
RETURNS setof hobbies_r
|
1997-04-06 10:29:57 +02:00
|
|
|
AS 'select * from hobbies_r where person = $1.name'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE SQL;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION hobby_construct(text, text)
|
1997-04-06 10:29:57 +02:00
|
|
|
RETURNS hobbies_r
|
|
|
|
AS 'select $1 as name, $2 as hobby'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE SQL;
|
2012-02-05 01:23:49 +01:00
|
|
|
CREATE FUNCTION hobby_construct_named(name text, hobby text)
|
|
|
|
RETURNS hobbies_r
|
|
|
|
AS 'select name, hobby'
|
|
|
|
LANGUAGE SQL;
|
2001-06-05 01:27:23 +02:00
|
|
|
CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE)
|
|
|
|
RETURNS hobbies_r.person%TYPE
|
|
|
|
AS 'select person from hobbies_r where name = $1'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE SQL;
|
2003-07-19 22:20:53 +02:00
|
|
|
NOTICE: type reference hobbies_r.name%TYPE converted to text
|
2005-04-01 00:46:33 +02:00
|
|
|
NOTICE: type reference hobbies_r.person%TYPE converted to text
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION equipment(hobbies_r)
|
1997-04-06 10:29:57 +02:00
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where hobby = $1.name'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE SQL;
|
2012-02-05 01:23:49 +01:00
|
|
|
CREATE FUNCTION equipment_named(hobby hobbies_r)
|
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where equipment_r.hobby = equipment_named.hobby.name'
|
|
|
|
LANGUAGE SQL;
|
|
|
|
CREATE FUNCTION equipment_named_ambiguous_1a(hobby hobbies_r)
|
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where hobby = equipment_named_ambiguous_1a.hobby.name'
|
|
|
|
LANGUAGE SQL;
|
|
|
|
CREATE FUNCTION equipment_named_ambiguous_1b(hobby hobbies_r)
|
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where equipment_r.hobby = hobby.name'
|
|
|
|
LANGUAGE SQL;
|
|
|
|
CREATE FUNCTION equipment_named_ambiguous_1c(hobby hobbies_r)
|
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where hobby = hobby.name'
|
|
|
|
LANGUAGE SQL;
|
|
|
|
CREATE FUNCTION equipment_named_ambiguous_2a(hobby text)
|
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where hobby = equipment_named_ambiguous_2a.hobby'
|
|
|
|
LANGUAGE SQL;
|
|
|
|
CREATE FUNCTION equipment_named_ambiguous_2b(hobby text)
|
|
|
|
RETURNS setof equipment_r
|
|
|
|
AS 'select * from equipment_r where equipment_r.hobby = hobby'
|
|
|
|
LANGUAGE SQL;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION user_relns()
|
1997-04-06 10:29:57 +02:00
|
|
|
RETURNS setof name
|
2010-11-23 21:27:50 +01:00
|
|
|
AS 'select relname
|
2002-12-14 01:24:35 +01:00
|
|
|
from pg_class c, pg_namespace n
|
|
|
|
where relnamespace = n.oid and
|
|
|
|
(nspname !~ ''pg_.*'' and nspname <> ''information_schema'') and
|
1997-04-06 10:29:57 +02:00
|
|
|
relkind <> ''i'' '
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE SQL;
|
2000-01-05 18:32:18 +01:00
|
|
|
CREATE FUNCTION pt_in_widget(point, widget)
|
2000-06-13 09:35:40 +02:00
|
|
|
RETURNS bool
|
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 overpaid(emp)
|
1997-04-06 10:29:57 +02:00
|
|
|
RETURNS bool
|
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 boxarea(box)
|
2000-06-13 09:35:40 +02:00
|
|
|
RETURNS float8
|
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 interpt_pp(path, path)
|
1997-04-06 10:29:57 +02:00
|
|
|
RETURNS point
|
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 reverse_name(name)
|
1998-04-26 06:12:15 +02:00
|
|
|
RETURNS name
|
2008-10-02 00:38:57 +02:00
|
|
|
AS '@libdir@/regress@DLSUFFIX@'
|
2006-02-27 17:09:50 +01:00
|
|
|
LANGUAGE C;
|
2000-11-20 21:36:57 +01:00
|
|
|
CREATE FUNCTION oldstyle_length(int4, text)
|
|
|
|
RETURNS int4
|
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
|
|
|
--
|
|
|
|
-- Function dynamic loading
|
|
|
|
--
|
2008-10-02 00:38:57 +02:00
|
|
|
LOAD '@libdir@/regress@DLSUFFIX@';
|