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; 8 9 10CREATE FUNCTION hobby_construct(text, text) 11 RETURNS hobbies_r 12 AS 'select $1 as name, $2 as hobby' 13 LANGUAGE SQL; 14 15 16CREATE FUNCTION hobby_construct_named(name text, hobby text) 17 RETURNS hobbies_r 18 AS 'select name, hobby' 19 LANGUAGE SQL; 20 21 22CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE) 23 RETURNS hobbies_r.person%TYPE 24 AS 'select person from hobbies_r where name = $1' 25 LANGUAGE SQL; 26 27 28CREATE FUNCTION equipment(hobbies_r) 29 RETURNS setof equipment_r 30 AS 'select * from equipment_r where hobby = $1.name' 31 LANGUAGE SQL; 32 33 34CREATE FUNCTION equipment_named(hobby hobbies_r) 35 RETURNS setof equipment_r 36 AS 'select * from equipment_r where equipment_r.hobby = equipment_named.hobby.name' 37 LANGUAGE SQL; 38 39CREATE FUNCTION equipment_named_ambiguous_1a(hobby hobbies_r) 40 RETURNS setof equipment_r 41 AS 'select * from equipment_r where hobby = equipment_named_ambiguous_1a.hobby.name' 42 LANGUAGE SQL; 43 44CREATE FUNCTION equipment_named_ambiguous_1b(hobby hobbies_r) 45 RETURNS setof equipment_r 46 AS 'select * from equipment_r where equipment_r.hobby = hobby.name' 47 LANGUAGE SQL; 48 49CREATE FUNCTION equipment_named_ambiguous_1c(hobby hobbies_r) 50 RETURNS setof equipment_r 51 AS 'select * from equipment_r where hobby = hobby.name' 52 LANGUAGE SQL; 53 54CREATE FUNCTION equipment_named_ambiguous_2a(hobby text) 55 RETURNS setof equipment_r 56 AS 'select * from equipment_r where hobby = equipment_named_ambiguous_2a.hobby' 57 LANGUAGE SQL; 58 59CREATE FUNCTION equipment_named_ambiguous_2b(hobby text) 60 RETURNS setof equipment_r 61 AS 'select * from equipment_r where equipment_r.hobby = hobby' 62 LANGUAGE SQL; 63 64 65CREATE FUNCTION pt_in_widget(point, widget) 66 RETURNS bool 67 AS '@libdir@/regress@DLSUFFIX@' 68 LANGUAGE C STRICT; 69 70CREATE FUNCTION overpaid(emp) 71 RETURNS bool 72 AS '@libdir@/regress@DLSUFFIX@' 73 LANGUAGE C STRICT; 74 75CREATE FUNCTION interpt_pp(path, path) 76 RETURNS point 77 AS '@libdir@/regress@DLSUFFIX@' 78 LANGUAGE C STRICT; 79 80CREATE FUNCTION reverse_name(name) 81 RETURNS name 82 AS '@libdir@/regress@DLSUFFIX@' 83 LANGUAGE C STRICT; 84 85-- 86-- Function dynamic loading 87-- 88LOAD '@libdir@/regress@DLSUFFIX@'; 89