ALTER EXTENSION .. ADD/DROP weirdness - Mailing list pgsql-hackers

From Robert Haas
Subject ALTER EXTENSION .. ADD/DROP weirdness
Date
Msg-id CA+TgmoY6ZBuh_88713xsuSF2ob_JjsuTDzQyzeJtWQozytF+Yw@mail.gmail.com
Whole thread Raw
Responses Re: ALTER EXTENSION .. ADD/DROP weirdness
List pgsql-hackers
OK, I'm stumped:

rhaas=# create extension pg_stat_statements;
CREATE EXTENSION
rhaas=# drop view pg_stat_statements;
ERROR:  cannot drop view pg_stat_statements because extension
pg_stat_statements requires it
HINT:  You can drop extension pg_stat_statements instead.
rhaas=# alter extension pg_stat_statements drop view pg_stat_statements;
ALTER EXTENSION
rhaas=# drop view pg_stat_statements;
ERROR:  cannot drop view pg_stat_statements because other objects depend on it
DETAIL:  extension pg_stat_statements depends on view pg_stat_statements
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

At the very last, the error message is totally confusing, because the
point is that I just removed that object from the extension, and I'm
being told that I can't remove it because it's part of the extension.
A little snooping around with \dx+ reveals a possible cause: the view
itself has been removed from the extension, but the associated types
are still connected to it:

rhaas=# \dx+ pg_stat_statements
Objects in extension "pg_stat_statements"        Object Description
-------------------------------------function pg_stat_statements()function pg_stat_statements_reset()type
pg_stat_statementstypepg_stat_statements[]
 
(4 rows)

OK, no problem, I'll just disconnect those, too:

rhaas=# alter extension pg_stat_statements drop type pg_stat_statements;
ALTER EXTENSION
rhaas=# alter extension pg_stat_statements drop type pg_stat_statements[];
ERROR:  syntax error at or near "["
LINE 1: ...extension pg_stat_statements drop type pg_stat_statements[];
                 ^
 

Hmm.  So just how do I do this?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Extend file_fdw wrapper
Next
From: Andrew Dunstan
Date:
Subject: Re: Extend file_fdw wrapper