Search Postgresql Archives

Re: How do write schema independent install files for functions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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;

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. 
http://www.postgresql.org/docs/9.1/static/ddl-schemas.html#sql-createschema.html

Regards,
Bartek

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux