Re: How do write schema independent install files for functions. - Mailing list pgsql-general

From Bartosz Dmytrak
Subject Re: How do write schema independent install files for functions.
Date
Msg-id CAD8_UcaFYbgVfEgoE-MUFvwYs7VgyGBsOjdP5OfH+VPJVp62MA@mail.gmail.com
Whole thread Raw
In response to How do write schema independent install files for functions.  (Philip Couling <phil@pedal.me.uk>)
List pgsql-general


2012/7/16 Philip Couling <phil@pedal.me.uk>

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;

CREATE OR REPLACE FUNCTION another_schema.bar()
  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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How do write schema independent install files for functions.
Next
From: Philip Couling
Date:
Subject: Re: How do write schema independent install files for functions.