Re: BUG #6116: Not able to drop user if S/he has permission on tablespace

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: tushar <tushar(dot)qa(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6116: Not able to drop user if S/he has permission on tablespace
Date: 2011-07-20 19:11:47
Message-ID: CA+Tgmob_QD8LDeHPTCA8=vpdVjmg7dBxWSuxk7AV9mP2TS6m2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jul 13, 2011 at 8:57 AM, tushar <tushar(dot)qa(at)gmail(dot)com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      6116
> Logged by:          tushar
> Email address:      tushar(dot)qa(at)gmail(dot)com
> PostgreSQL version: 9.0
> Operating system:   Fedora 14
> Description:        Not able to drop user if S/he has permission on
> tablespace
> Details:
>
> Steps to reproduce
> ================
>
> \\create a directory
>
> postgres=# \! mkdir /tmp/g100
>
> \\create a tablespace
> postgres=#  CREATE TABLESPACE f location '/tmp/g100';
> CREATE TABLESPACE
>
> \\create a User
> postgres=# CREATE user abc;
> CREATE ROLE
>
> \\grant all on tablespace to user
>
> postgres=# GRANT all on TABLESPACE f to abc;
> GRANT
>
> \\drop permission from user
>
> postgres=# drop owned by abc;
> DROP OWNED
>
> \\ Try to drop User
> postgres=# drop user abc ;
> ERROR:  role "abc" cannot be dropped because some objects depend on it
> DETAIL:  privileges for tablespace f
> postgres=#

The "DROP OWNED BY" command only drops objects that are owned by a
user. It doesn't revoke privileges that user has granted: those
aren't considered dropable objects. So technically speaking all of
those commands are working just as expected.

Nevertheless, I agree with you that the behavior here leaves a lot to
be desired. Hunting down the privilege grant that is stopping you
from dropping a user is pretty darn annoying. I am not sure what to
do about that, though.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2011-07-20 19:55:02 Re: BUG #6116: Not able to drop user if S/he has permission on tablespace
Previous Message Robert Haas 2011-07-20 19:06:47 Re: PostgreSQL fails to build with 32bit MinGW-w64