Re: Multiple Schema and extensions

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Alan Nilsson *EXTERN*" <anilsson(at)apple(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Multiple Schema and extensions
Date: 2012-09-26 08:58:21
Message-ID: D960CB61B694CF459DCFB4B0128514C20874BE68@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alan Nilsson wrote:
> Is it the case that extensions can be added to only one schema? If
so, what is the recommended
> practice for accessing a function from an extension in multiple
schemas?

Yes, a (relocatable) extension can belong to only one schema.
There are two ways to access the functions:
1) Use qualified names.
2) Set search_path to contain the schema.

> Is it *ok* to load the extension in the pg_catalog schema so functions
can be accessed by unqualified
> names? Is it *better* to have a separate schema for functions and use
qualified names to access?
> What is the general accepted practice?

No, that is not ok.
pg_catalog is only for system objects.
You should use schema "public" - that is in search_path by
default, and everybody can use it.

> As a side note:
> ALTER EXTENSION foo ADD SCHEMA bar
> What the heck does this do? AFICS, it has no effect on the visibility
of an extension function in the
> *added* schema.

This makes "bar" belong to extension "foo", not the other way around.
The effect is that
a) "bar" will not be dumped by pg_dump
b) "DROP EXTENSION foo" will drop schema "bar"

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-09-26 09:14:38 Re: idle in transaction query makes server unresponsive
Previous Message Albe Laurenz 2012-09-26 08:40:12 Re: PostgreSQL data loads - turn off WAL