Search Postgresql Archives

Re: =?x-gbk?q?=BB=D8=B8=B4=A3=BA_=5BGENERAL=5D_How?==?x-gbk?q?_to_make_the_user-defined_function_or_type_bei?==?x-gbk?q?ngaccessed_in_the_global_database_server=3F?=

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

 



On 20/02/2011 2:13 PM, Ò³¹«µ¹Áú wrote:
Thanks for your replying. But actually there are some difference
database now, and I really want to define the user-defined function or
type one time so that they can be accessed as system-defined function or
type, how can I do?

It sounds like you want something like Oracle's packages. If so, you're out of luck: postgresql doesn't support anything like that at this point.

Bundle the functions, type definitions, etc up in a .sql file and run that on each database. It's cleanest if you do this by creating a new schema called, say, 'shared', then SET search_path=shared before creating the functions and types. That way they all go in one place that's separated from the per-database content. To access them, SET search_path=shared,public . You can "ALTER USER SET search_path=shared,public" or "ALTER DATABASE SET search_path=shared,public" to make it default.

See the manual for more information about schema, and the commands/options:

  SET
  search_path
  CREATE SCHEMA
  CREATE FUNCTION

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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