Thread: Can't move extension out of pg_catalog

Can't move extension out of pg_catalog

From
Daniele Varrazzo
Date:
After moving an extension into the pg_catalog schema, it seems
impossible to move it somewhere else:

test=# create extension ltree;
CREATE EXTENSION
test=# alter extension ltree set schema pg_catalog;
ALTER EXTENSION
test=# alter extension ltree set schema public;
ERROR:  cannot remove dependency on schema pg_catalog because it is a
system object.

It is still possible to drop it.

Tested with PostgreSQL 9.1.3.

-- Daniele

Re: Can't move extension out of pg_catalog

From
Tom Lane
Date:
Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:
> After moving an extension into the pg_catalog schema, it seems
> impossible to move it somewhere else:

> test=# create extension ltree;
> CREATE EXTENSION
> test=# alter extension ltree set schema pg_catalog;
> ALTER EXTENSION
> test=# alter extension ltree set schema public;
> ERROR:  cannot remove dependency on schema pg_catalog because it is a
> system object.

Yeah, this is an implementation restriction that is unlikely to get
changed anytime soon.  The problem is that moving the extension's
objects into pg_catalog results in dropping all their namespace
dependencies (since pg_catalog is a pinned object) and then there
is no way to resurrect that data if we want to move them someplace else.
See changeDependencyFor() in catalog/pg_depend.c.

Possibly it would be better to disallow this ALTER in both directions,
ie remove the support for the "drop the dependency" case in
changeDependencyFor().

            regards, tom lane