1-- 2-- CREATE_FUNCTION_2 3-- 4CREATE FUNCTION hobbies(person) 5 RETURNS setof hobbies_r 6 AS 'select * from hobbies_r where person = $1.name' 7 LANGUAGE SQL; 8CREATE FUNCTION hobby_construct(text, text) 9 RETURNS hobbies_r 10 AS 'select $1 as name, $2 as hobby' 11 LANGUAGE SQL; 12CREATE FUNCTION hobby_construct_named(name text, hobby text) 13 RETURNS hobbies_r 14 AS 'select name, hobby' 15 LANGUAGE SQL; 16CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE) 17 RETURNS hobbies_r.person%TYPE 18 AS 'select person from hobbies_r where name = $1' 19 LANGUAGE SQL; 20NOTICE: type reference hobbies_r.name%TYPE converted to text 21NOTICE: type reference hobbies_r.person%TYPE converted to text 22CREATE FUNCTION equipment(hobbies_r) 23 RETURNS setof equipment_r 24 AS 'select * from equipment_r where hobby = $1.name' 25 LANGUAGE SQL; 26CREATE FUNCTION equipment_named(hobby hobbies_r) 27 RETURNS setof equipment_r 28 AS 'select * from equipment_r where equipment_r.hobby = equipment_named.hobby.name' 29 LANGUAGE SQL; 30CREATE FUNCTION equipment_named_ambiguous_1a(hobby hobbies_r) 31 RETURNS setof equipment_r 32 AS 'select * from equipment_r where hobby = equipment_named_ambiguous_1a.hobby.name' 33 LANGUAGE SQL; 34CREATE FUNCTION equipment_named_ambiguous_1b(hobby hobbies_r) 35 RETURNS setof equipment_r 36 AS 'select * from equipment_r where equipment_r.hobby = hobby.name' 37 LANGUAGE SQL; 38CREATE FUNCTION equipment_named_ambiguous_1c(hobby hobbies_r) 39 RETURNS setof equipment_r 40 AS 'select * from equipment_r where hobby = hobby.name' 41 LANGUAGE SQL; 42CREATE FUNCTION equipment_named_ambiguous_2a(hobby text) 43 RETURNS setof equipment_r 44 AS 'select * from equipment_r where hobby = equipment_named_ambiguous_2a.hobby' 45 LANGUAGE SQL; 46CREATE FUNCTION equipment_named_ambiguous_2b(hobby text) 47 RETURNS setof equipment_r 48 AS 'select * from equipment_r where equipment_r.hobby = hobby' 49 LANGUAGE SQL; 50CREATE FUNCTION pt_in_widget(point, widget) 51 RETURNS bool 52 AS '@libdir@/regress@DLSUFFIX@' 53 LANGUAGE C STRICT; 54CREATE FUNCTION overpaid(emp) 55 RETURNS bool 56 AS '@libdir@/regress@DLSUFFIX@' 57 LANGUAGE C STRICT; 58CREATE FUNCTION interpt_pp(path, path) 59 RETURNS point 60 AS '@libdir@/regress@DLSUFFIX@' 61 LANGUAGE C STRICT; 62CREATE FUNCTION reverse_name(name) 63 RETURNS name 64 AS '@libdir@/regress@DLSUFFIX@' 65 LANGUAGE C STRICT; 66CREATE FUNCTION oldstyle_length(int4, text) 67 RETURNS int4 68 AS '@libdir@/regress@DLSUFFIX@' 69 LANGUAGE C; -- intentionally not strict 70-- 71-- Function dynamic loading 72-- 73LOAD '@libdir@/regress@DLSUFFIX@'; 74