PostgreSQL/src/test/regress/input/create_function_2.source
Tom Lane 5bb2300b59 Revise handling of oldstyle/newstyle functions per recent discussions
in pghackers list.  Support for oldstyle internal functions is gone
(no longer needed, since conversion is complete) and pg_language entry
'internal' now implies newstyle call convention.  pg_language entry
'newC' is gone; both old and newstyle dynamically loaded C functions
are now called language 'C'.  A newstyle function must be identified
by an associated info routine.  See src/backend/utils/fmgr/README.
2000-11-20 20:36:57 +00:00

65 lines
1.3 KiB
Plaintext

--
-- 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 equipment(hobbies_r)
RETURNS setof equipment_r
AS 'select * from equipment_r where hobby = $1.name'
LANGUAGE 'sql';
CREATE FUNCTION user_relns()
RETURNS setof name
AS 'select relname
from pg_class
where relname !~ ''pg_.*'' and
relkind <> ''i'' '
LANGUAGE 'sql';
CREATE FUNCTION pt_in_widget(point, widget)
RETURNS bool
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'C';
CREATE FUNCTION overpaid(emp)
RETURNS bool
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'C';
CREATE FUNCTION boxarea(box)
RETURNS float8
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'C';
CREATE FUNCTION interpt_pp(path, path)
RETURNS point
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'C';
CREATE FUNCTION reverse_name(name)
RETURNS name
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
CREATE FUNCTION oldstyle_length(int4, text)
RETURNS int4
AS '@abs_builddir@/regress@DLSUFFIX@'
LANGUAGE 'c';
--
-- Function dynamic loading
--
LOAD '@abs_builddir@/regress@DLSUFFIX@';