summaryrefslogtreecommitdiff
path: root/test/expected/plproxy_errors.out
blob: ec6a4fc823a497d318fd0bef468c8248878e9dd7 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
-- test bad arg
create function test_err1(dat text)
returns text as $$
    cluster 'testcluster';
    run on hashtext(username);
$$ language plproxy;
select * from test_err1('dat');
ERROR:  column "username" does not exist
LINE 1: select * from hashtext(username)
                               ^
QUERY:  select * from hashtext(username)
create function test_err2(dat text)
returns text as $$
    cluster 'testcluster';
    run on hashtext($2);
$$ language plproxy;
ERROR:  PL/Proxy function public.test_err2(1): Compile error at line 3: invalid argument reference: $2
select * from test_err2('dat');
ERROR:  function test_err2(unknown) does not exist
LINE 1: select * from test_err2('dat');
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
create function test_err3(dat text)
returns text as $$
    cluster 'nonexists';
    run on hashtext($1);
$$ language plproxy;
select * from test_err3('dat');
ERROR:  no such cluster: nonexists
CONTEXT:  SQL statement "select * from plproxy.get_cluster_version($1)"
-- should work
create function test_err_none(dat text)
returns text as $$
    cluster 'testcluster';
    run on hashtext($1);
    select 'ok';
$$ language plproxy;
select * from test_err_none('dat');
 test_err_none 
---------------
 ok
(1 row)

--- result map errors
create function test_map_err1(dat text)
returns text as $$ cluster 'testcluster'; run on 0;
    select dat as "foo", 'asd' as "bar";
$$ language plproxy;
select * from test_map_err1('dat');
ERROR:  PL/Proxy function public.test_map_err1(1): single field function but got record
create function test_map_err2(dat text, out res1 text, out res2 text)
returns record as $$ cluster 'testcluster'; run on 0;
    select dat as res1;
$$ language plproxy;
select * from test_map_err2('dat');
ERROR:  PL/Proxy function public.test_map_err2(1): Got too few fields from remote end
create function test_map_err3(dat text, out res1 text, out res2 text)
returns record as $$ cluster 'testcluster'; run on 0;
    select dat as res1, 'foo' as res_none;
$$ language plproxy;
select * from test_map_err3('dat');
ERROR:  PL/Proxy function public.test_map_err3(1): Field res2 does not exists in result
create function test_map_err4(dat text, out res1 text, out res2 text)
returns record as $$
    --cluster 'testcluster';
    run on hashtext(dat);
    select dat as res2, 'foo' as res1;
$$ language plproxy;
ERROR:  PL/Proxy function public.test_map_err4(1): Compile error at line 5: CLUSTER statement missing
select * from test_map_err4('dat');
ERROR:  function test_map_err4(unknown) does not exist
LINE 1: select * from test_map_err4('dat');
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
create function test_variadic_err(first text, rest variadic text[])
returns text as $$
    cluster 'testcluster';
$$ language plproxy;
ERROR:  PL/Proxy does not support variadic args
select * from test_variadic_err('dat', 'dat', 'dat');
ERROR:  function test_variadic_err(unknown, unknown, unknown) does not exist
LINE 1: select * from test_variadic_err('dat', 'dat', 'dat');
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
create function test_volatile_err(dat text)
returns text
stable
as $$
    cluster 'testcluster';
$$ language plproxy;
ERROR:  PL/Proxy functions must be volatile
select * from test_volatile_err('dat');
ERROR:  function test_volatile_err(unknown) does not exist
LINE 1: select * from test_volatile_err('dat');
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
create function test_pseudo_arg_err(dat cstring)
returns text
as $$
    cluster 'testcluster';
$$ language plproxy;
ERROR:  PL/Proxy function public.test_pseudo_arg_err(0): unsupported pseudo type: cstring (2275)
select * from test_pseudo_arg_err(textout('dat'));
ERROR:  function test_pseudo_arg_err(cstring) does not exist
LINE 1: select * from test_pseudo_arg_err(textout('dat'));
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
create function test_pseudo_ret_err(dat text)
returns cstring
as $$
    cluster 'testcluster';
$$ language plproxy;
-- not detected in validator
select * from test_pseudo_ret_err('dat');
ERROR:  PL/Proxy function public.test_pseudo_ret_err(0): unsupported pseudo type: cstring (2275)
create function test_runonall_err(dat text)
returns text
as $$
    cluster 'testcluster';
    run on all;
$$ language plproxy;
ERROR:  PL/Proxy function public.test_runonall_err(1): RUN ON ALL requires set-returning function
select * from test_runonall_err('dat');
ERROR:  function test_runonall_err(unknown) does not exist
LINE 1: select * from test_runonall_err('dat');
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.