ALTER EXTENSION .. ADD/DROP weirdness

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ALTER EXTENSION .. ADD/DROP weirdness
Date: 2011-10-10 14:01:51
Message-ID: CA+TgmoY6ZBuh_88713xsuSF2ob_JjsuTDzQyzeJtWQozytF+Yw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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_statements
type pg_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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-10-10 14:18:08 Re: pgsql: Cascading replication feature for streaming log-based replicatio
Previous Message David Fetter 2011-10-10 13:57:39 Re: Extend file_fdw wrapper