--
-- 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;
NOTICE: type reference hobbies_r.name%TYPE converted to text
NOTICE: type reference hobbies_r.person%TYPE converted to text
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 nspname <> ''dbe_perf'') and
relkind <> ''i'' '
LANGUAGE SQL;
CREATE FUNCTION pt_in_widget(point, widget)
RETURNS bool
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C NOT FENCED;
ERROR: type widget does not exist
CREATE FUNCTION overpaid(emp)
RETURNS bool
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C NOT FENCED;
CREATE FUNCTION boxarea(box)
RETURNS float8
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C NOT FENCED;
CREATE FUNCTION interpt_pp(path, path)
RETURNS point
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C NOT FENCED;
CREATE FUNCTION reverse_name(name)
RETURNS name
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C NOT FENCED;
CREATE FUNCTION oldstyle_length(int4, text)
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C NOT FENCED;
start transaction;
drop function oldstyle_length;
rollback;
select oldstyle_length(10, 'abc');
oldstyle_length
-----------------
13
(1 row)
start transaction;
CREATE or replace FUNCTION oldstyle_length(int4, text)
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@'
LANGUAGE C;
rollback;
select oldstyle_length(10, 'abc');
oldstyle_length
-----------------
13
(1 row)
create schema vec_function_call;
set current_schema=vec_function_call;
create table test_vec_int4add(t1 int,t2 int,t3 int, t4 int) with (orientation = column);
insert into test_vec_int4add values(1,2,3,4);
insert into test_vec_int4add values(5,6,7,8);
CREATE FUNCTION vec_int4add_0()
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@', 'vec_int4add_0'
LANGUAGE C IMMUTABLE NOT FENCED;
CREATE FUNCTION vec_int4add_0_strict()
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@', 'vec_int4add_0'
LANGUAGE C strict IMMUTABLE NOT FENCED;
select * from test_vec_int4add where vec_int4add_0() > 0 order by 1,2,3,4;
t1 | t2 | t3 | t4
----+----+----+----
1 | 2 | 3 | 4
5 | 6 | 7 | 8
(2 rows)
select * from test_vec_int4add where vec_int4add_0_strict() > 0 order by 1,2,3,4;
t1 | t2 | t3 | t4
----+----+----+----
1 | 2 | 3 | 4
5 | 6 | 7 | 8
(2 rows)
CREATE FUNCTION vec_int4add_1(int)
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@', 'vec_int4add_0'
LANGUAGE C IMMUTABLE NOT FENCED;
select * from test_vec_int4add where vec_int4add_1(t1) > 0 order by 1,2,3,4;
t1 | t2 | t3 | t4
----+----+----+----
1 | 2 | 3 | 4
5 | 6 | 7 | 8
(2 rows)
CREATE FUNCTION vec_int4add_32
(int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4)
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@', 'vec_int4add_11'
LANGUAGE C IMMUTABLE NOT FENCED;
CREATE FUNCTION vec_int4add_32_strict
(int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4)
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@', 'vec_int4add_11'
LANGUAGE C strict IMMUTABLE NOT FENCED;
select * from test_vec_int4add where vec_int4add_32
(t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4) > 0 order by 1,2,3,4;
t1 | t2 | t3 | t4
----+----+----+----
1 | 2 | 3 | 4
5 | 6 | 7 | 8
(2 rows)
select * from test_vec_int4add where vec_int4add_32_strict
(t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4) > 0 order by 1,2,3,4;
t1 | t2 | t3 | t4
----+----+----+----
1 | 2 | 3 | 4
5 | 6 | 7 | 8
(2 rows)
CREATE FUNCTION vec_int4add_33
(int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4,int4,int4,int4,int4,int4,int4,int4
,int4)
RETURNS int4
AS '@libdir@/regress@DLSUFFIX@', 'vec_int4add_11'
LANGUAGE C IMMUTABLE NOT FENCED;
select * from test_vec_int4add where vec_int4add_33
(t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1,t2,t3,t4,t1,t2,t3,t4
,t1) > 0 order by 1,2,3,4;
t1 | t2 | t3 | t4
----+----+----+----
1 | 2 | 3 | 4
5 | 6 | 7 | 8
(2 rows)
CREATE FUNCTION test_int4add_0()
RETURNS int4
AS '$libdir/pg_plugin/coordinator1#regress.so', 'vec_int4add_0'
LANGUAGE C IMMUTABLE NOT FENCED;
ERROR: File "$libdir/pg_plugin/coordinator1#regress.so" does not exist.
drop schema vec_function_call cascade;
NOTICE: drop cascades to 7 other objects
DETAIL: drop cascades to table test_vec_int4add
drop cascades to function vec_int4add_0()
drop cascades to function vec_int4add_0_strict()
drop cascades to function vec_int4add_1(integer)
drop cascades to function vec_int4add_32(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer)
drop cascades to function vec_int4add_32_strict(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer)
drop cascades to function vec_int4add_33(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer)
--
-- Function dynamic loading
--
LOAD '@libdir@/regress@DLSUFFIX@';
ERROR: LOAD statement is not yet supported.