-- Adjust this setting to control where the objects get created.
SET search_path = public;

CREATE TABLE myfoo (f1 int, f2 text, f3 float8, f4 int[]);
-- would not normally be in the MODULE.sql.in file
INSERT INTO myfoo VALUES(1, 'abc', 3.14159, ARRAY[1,2,3]);
INSERT INTO myfoo VALUES(2, 'def', 2.8, ARRAY[6,7,8]);

CREATE OR REPLACE FUNCTION extract_field_as_text(myfoo, text)
RETURNS text
AS 'MODULE_PATHNAME','extract_field_as_text'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION create_singleton_array(int, anyelement)
RETURNS anyarray
AS 'MODULE_PATHNAME','create_array'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION build_row(text[])
RETURNS setof record
AS 'MODULE_PATHNAME','build_tuple_from_textarray'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION build_rows_funcapi(text[])
RETURNS setof record
AS 'MODULE_PATHNAME','build_tuples_from_textarray_funcapi'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION build_rows_tuplestore(text[])
RETURNS setof record
AS 'MODULE_PATHNAME','build_tuples_from_textarray'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION myfunc_throw_error(text)
RETURNS void
AS 'MODULE_PATHNAME','myfunc_errcontext'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION myfunc_setvar(text, text)
RETURNS text
AS 'MODULE_PATHNAME','myfunc_setvar'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE OR REPLACE FUNCTION myfunc_getvar(text)
RETURNS text
AS 'MODULE_PATHNAME','myfunc_getvar'
LANGUAGE 'C' STABLE STRICT;

CREATE OR REPLACE FUNCTION myfunc_rmvar(text)
RETURNS text
AS 'MODULE_PATHNAME','myfunc_rmvar'
LANGUAGE 'C' IMMUTABLE STRICT;
