Skip site navigation (1) Skip section navigation (2)

Re: Drop Schema Error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bradley Holbrook" <operations_bradley(at)servillian(dot)ca>
Cc: 'Viktor Bojović' <viktor(dot)bojovic(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Drop Schema Error
Date: 2011-01-31 18:24:26
Message-ID: 19812.1296498266@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-admin
"Bradley Holbrook" <operations_bradley(at)servillian(dot)ca> writes:
> I renamed the schema from permissions to _old_permissions and I believe this caused the error.

Uh, no, certainly not.  pg_depend only cares about the objects' OIDs,
not their names.  Testing in 8.3, it works fine:

regression=# create schema old_permissions;
CREATE SCHEMA
regression=# create function old_permissions.foo() returns int as
regression-# 'select 2+2' language sql;
CREATE FUNCTION
regression=# create function old_permissions.foo2(int) returns int as
'begin return $1 + 1; end' language plpgsql;
CREATE FUNCTION
regression=# alter schema old_permissions rename to "_old_permissions";
ALTER SCHEMA
regression=# DROP SCHEMA "_old_permissions" ;
NOTICE:  function _old_permissions.foo2(integer) depends on schema _old_permissions
NOTICE:  function _old_permissions.foo() depends on schema _old_permissions
ERROR:  cannot drop schema _old_permissions because other objects depend on it
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
regression=# DROP SCHEMA "_old_permissions" CASCADE;
NOTICE:  drop cascades to function _old_permissions.foo2(integer)
NOTICE:  drop cascades to function _old_permissions.foo()
DROP SCHEMA
regression=# 

As I said, we've never seen a reproducible example.

			regards, tom lane

In response to

pgsql-admin by date

Next:From: Kevin GrittnerDate: 2011-01-31 18:48:47
Subject: Re: Clarification of pg_cotroldata output
Previous:From: Bradley HolbrookDate: 2011-01-31 18:00:03
Subject: Re: Drop Schema Error

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group