From: jeff@pgexperts.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations
Date: Sat, 23 Jun 2012 00:36:36 +0000
Message-ID: <E1SiEL6-0002u2-Ov@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 6704
Logged by: Jeff Frost
Email address: jeff@pgexperts.com
PostgreSQL version: 9.1.4
Operating system: Windows and Linux
Description:
DROP and CREATE extension appear to work fine, but if you ALTER EXTENSION
postgis SET SCHEMA foo, it leaves a few relations behind. Then if you drop
that schema, you can't pg_dump the DB anymore.
See reproducible test case below. Note a the bottom that even though the
ALTER left items in the original schema, I'm able to drop that schema
without CASCADE and also if I then DROP EXTENSION, it happily gets rid of
those.
Test case:
pgx-test:~ $ createdb ext_test
pgx-test:~ $ psql ext_test
psql (9.1.4)
Type "help" for help.
ext_test=# create schema test;
CREATE SCHEMA
Time: 27.736 ms
ext_test=# create EXTENSION postgis with schema test;
CREATE EXTENSION
Time: 764.102 ms
ext_test=# alter EXTENSION postgis set schema public;
ALTER EXTENSION
Time: 221.224 ms
ext_test=# select oid, nspname from pg_namespace ;
oid | nspname
---------+--------------------
99 | pg_toast
11124 | pg_temp_1
11125 | pg_toast_temp_1
11 | pg_catalog
2200 | public
12257 | information_schema
6981446 | test
(7 rows)
Time: 0.256 ms
ext_test=# select oid, relname, relnamespace from pg_class where
relnamespace = 6981446;
oid | relname | relnamespace
---------+----------------------+--------------
6981694 | spatial_ref_sys_pkey | 6981446
(1 row)
Time: 36.072 ms
ext_test=# select oid, proname, pronamespace from pg_proc where pronamespace
= 6981446;
oid | proname | pronamespace
-----+---------+--------------
(0 rows)
Time: 7.797 ms
ext_test=# select oid, typname, typnamespace from pg_type where typnamespace
= 6981446;
oid | typname | typnamespace
---------+--------------------+--------------
6981689 | spatial_ref_sys | 6981446
6981688 | _spatial_ref_sys | 6981446
6981995 | geography_columns | 6981446
6981994 | _geography_columns | 6981446
6982099 | geometry_columns | 6981446
6982098 | _geometry_columns | 6981446
6982541 | raster_columns | 6981446
6982540 | _raster_columns | 6981446
6982550 | raster_overviews | 6981446
6982549 | _raster_overviews | 6981446
(10 rows)
Time: 7.844 ms
ext_test=# select oid, conname, connamespace from pg_constraint where
connamespace = 6981446;
oid | conname | connamespace
---------+----------------------------+--------------
6981690 | spatial_ref_sys_srid_check | 6981446
6981695 | spatial_ref_sys_pkey | 6981446
(2 rows)
Time: 0.201 ms
ext_test=# DROP EXTENSION postgis ;
DROP EXTENSION
Time: 214.645 ms
ext_test=# select oid, relname, relnamespace from pg_class where
relnamespace = 6981446;
oid | relname | relnamespace
-----+---------+--------------
(0 rows)
Time: 49.484 ms
ext_test=# select oid, proname, pronamespace from pg_proc where pronamespace
= 6981446;
oid | proname | pronamespace
-----+---------+--------------
(0 rows)
Time: 7.698 ms
ext_test=# select oid, typname, typnamespace from pg_type where typnamespace
= 6981446;
oid | typname | typnamespace
-----+---------+--------------
(0 rows)
Time: 7.864 ms
ext_test=# select oid, conname, connamespace from pg_constraint where
connamespace = 6981446;
oid | conname | connamespace
-----+---------+--------------
(0 rows)
Time: 0.144 ms
ext_test=#
ext_test=# \q
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: jeff@pgexperts.com
Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations
In-Reply-To: <E1SiEL6-0002u2-Ov@wrigleys.postgresql.org>
References: <E1SiEL6-0002u2-Ov@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox