pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6116: Not able to drop user if S/he has permission on tablespace
3+ messages / 3 participants
[nested] [flat]

* BUG #6116: Not able to drop user if S/he has permission on tablespace
@ 2011-07-13 12:57  tushar <tushar.qa@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: tushar @ 2011-07-13 12:57 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      6116
Logged by:          tushar
Email address:      tushar.qa@gmail.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=#



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6116: Not able to drop user if S/he has permission on tablespace
@ 2011-07-20 19:11  Robert Haas <robertmhaas@gmail.com>
  parent: tushar <tushar.qa@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Robert Haas @ 2011-07-20 19:11 UTC (permalink / raw)
  To: tushar <tushar.qa@gmail.com>; +Cc: pgsql-bugs

On Wed, Jul 13, 2011 at 8:57 AM, tushar <tushar.qa@gmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      6116
> Logged by:          tushar
> Email address:      tushar.qa@gmail.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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6116: Not able to drop user if S/he has permission on tablespace
@ 2011-07-20 19:55  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2011-07-20 19:55 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: tushar <tushar.qa@gmail.com>; pgsql-bugs

Excerpts from Robert Haas's message of mié jul 20 15:11:47 -0400 2011:

> 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.

The message detail indicates what's the grant that needs to be revoked.
IIRC we discussed whether DROP OWNED should revoke privileges on
tablespaces and databases just like it does for regular (non shared)
objects, but that went nowhere and nothing got done about it.

I think the expectation is that a combination of DROP OWNED and REASSIGN
OWNED, when applied to sufficient databases, should be enough to let you
drop a user.  With that in mind, fixing this bug should be
straightforward.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-07-20 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-07-13 12:57 BUG #6116: Not able to drop user if S/he has permission on tablespace tushar <tushar.qa@gmail.com>
2011-07-20 19:11 ` Robert Haas <robertmhaas@gmail.com>
2011-07-20 19:55   ` Alvaro Herrera <alvherre@commandprompt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox