aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/input/create_function_2.source
blob: c5185597775f5f6f5ea3617e11d5ef7071d9fe25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--
-- CREATE_FUNCTION_2
--
CREATE FUNCTION hobbies(person)
   RETURNS setof hobbies_r
   AS 'select * from hobbies_r where person = $1.name'
   LANGUAGE SQL;


CREATE FUNCTION hobby_construct(text, text)
   RETURNS hobbies_r
   AS 'select $1 as name, $2 as hobby'
   LANGUAGE SQL;


CREATE FUNCTION hobby_construct_named(name text, hobby text)
   RETURNS hobbies_r
   AS 'select name, hobby'
   LANGUAGE SQL;


CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE)
   RETURNS hobbies_r.person%TYPE
   AS 'select person from hobbies_r where name = $1'
   LANGUAGE SQL;


CREATE FUNCTION equipment(hobbies_r)
   RETURNS setof equipment_r
   AS 'select * from equipment_r where hobby = $1.name'
   LANGUAGE SQL;


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;


CREATE FUNCTION user_relns()
   RETURNS setof name
   AS 'select relname
       from pg_class c, pg_namespace n
       where relnamespace = n.oid and
             (nspname !~ ''pg_.*'' and nspname <> ''information_schema'') and
             relkind <> ''i'' '
   LANGUAGE SQL;

CREATE FUNCTION pt_in_widget(point, widget)
   RETURNS bool
   AS '@libdir@/regress@DLSUFFIX@'
   LANGUAGE C STRICT;

CREATE FUNCTION overpaid(emp)
   RETURNS bool
   AS '@libdir@/regress@DLSUFFIX@'
   LANGUAGE C STRICT;

CREATE FUNCTION boxarea(box)
   RETURNS float8
   AS '@libdir@/regress@DLSUFFIX@'
   LANGUAGE C STRICT;

CREATE FUNCTION interpt_pp(path, path)
   RETURNS point
   AS '@libdir@/regress@DLSUFFIX@'
   LANGUAGE C STRICT;

CREATE FUNCTION reverse_name(name)
   RETURNS name
   AS '@libdir@/regress@DLSUFFIX@'
   LANGUAGE C STRICT;

CREATE FUNCTION oldstyle_length(int4, text)
   RETURNS int4
   AS '@libdir@/regress@DLSUFFIX@'
   LANGUAGE C;  -- intentionally not strict

--
-- Function dynamic loading
--
LOAD '@libdir@/regress@DLSUFFIX@';