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
|
-- test target clause
create function test_target(xuser text, tmp boolean)
returns text as $$
cluster 'testcluster';
run on 0;
target test_target_dst;
$$ language plproxy;
\c test_part0
create function test_target_dst(xuser text, tmp boolean)
returns text as $$
begin
return 'dst';
end;
$$ language plpgsql;
\c regression
select * from test_target('foo', true);
test_target
-------------
dst
(1 row)
-- test errors
create function test_target_err1(xuser text)
returns text as $$
cluster 'testcluster';
run on 0;
target test_target_dst;
target test_target_dst;
$$ language plproxy;
ERROR: PL/Proxy function public.test_target_err1(1): Compile error at line 5: Only one TARGET statement allowed
select * from test_target_err1('asd');
ERROR: function test_target_err1(unknown) does not exist
LINE 1: select * from test_target_err1('asd');
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
create function test_target_err2(xuser text)
returns text as $$
cluster 'testcluster';
run on 0;
target test_target_dst;
select 1;
$$ language plproxy;
ERROR: PL/Proxy function public.test_target_err2(1): Compile error at line 6: TARGET cannot be used with SELECT
select * from test_target_err2('asd');
ERROR: function test_target_err2(unknown) does not exist
LINE 1: select * from test_target_err2('asd');
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|