Re: ALTER OBJECT any_name SET SCHEMA name

Dimitri Fontaine <dimitri@2ndquadrant.fr>

From: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dimitri Fontaine <dimitri@2ndQuadrant.fr>, Alvaro Herrera <alvherre@commandprompt.com>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2010-11-05T19:58:00Z
Lists: pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> You're mistaken, and this case definitely does need more thought.
> A schema owner is presumed to have the unconditional right to
> drop anything in his schema, whether he owns it or not.

Here a paste of how it works with current code.

dim=# create schema bob authorization bob;
CREATE SCHEMA

dim=# alter extension unaccent set schema bob;
ALTER EXTENSION

dim=# \c - bob
You are now connected to database "dim" as user "bob".

dim=> drop schema bob;
ERROR:  cannot drop schema bob because other objects depend on it
DETAIL:  extension unaccent depends on schema bob
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

dim=> drop schema bob cascade;
NOTICE:  drop cascades to extension unaccent
DROP SCHEMA

dim=> \c - dim
You are now connected to database "dim" as user "dim".
dim=# select installed from pg_extensions where name = 'unaccent';
 installed 
-----------
 f
(1 row)

Isn't that enough for you?
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support