Re: Multiple Schema and extensions - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Multiple Schema and extensions
Date
Msg-id D960CB61B694CF459DCFB4B0128514C20874BE68@exadv11.host.magwien.gv.at
Whole thread Raw
In response to Multiple Schema and extensions  (Alan Nilsson <anilsson@apple.com>)
List 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


pgsql-general by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: PostgreSQL data loads - turn off WAL
Next
From: "Albe Laurenz"
Date:
Subject: Re: idle in transaction query makes server unresponsive