2012/7/16 Philip Couling <phil@xxxxxxxxxxx>
Is there any more flexible way to do this?
Hi,
in my opinion you should use fully qualified names instead of set search_path
Your script should look like this:
CREATE OR REPLACE FUNCTION my_schema.foo()
RETURNS INTEGER AS
$BODY$
BEGIN
RETURN 42;
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
$BODY$
BEGIN
RETURN 42;
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
CREATE OR REPLACE FUNCTION another_schema.bar()
RETURNS INTEGER AS
$BODY$
BEGIN
RETURN my_schema.foo();
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
RETURNS INTEGER AS
$BODY$
BEGIN
RETURN my_schema.foo();
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
then script is readable and uses full qualified names.
Regards,
Bartek