Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262" - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
Date
Msg-id 20130125195716.GI5584@alvh.no-ip.org
Whole thread Raw
In response to Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
List pgsql-bugs
Jeff Janes escribió:

> Since back-branch releases are coming up, I think fe3b5eb08 and it's
> analogues in all branches should be reverted.
>
> The issue it was intended to solve was not really a bug in the first place,
> and this patch didn't solve it anyway. But it introduced new behavior (into
> all supported branches) which certainly is a bug.

I disagree with this assessment, and propose the attached patch instead.

The documentation for DROP OWNED says in its opening paragraph "Any
privileges granted to the given roles on objects in the current database
will also be revoked."  So commit fe3b5eb08 was correct, though
incomplete; DROP OWNED is really supposed to operate on tablespaces and
databases.  Not drop them, mind you --- but if the user has been granted
privileges on them, those should be revoked.

On the other hand, running REASSIGN OWNED means to reassign ownership of
objects to some other user.  There is no reason this cannot be done to
shared objects as well as local objects.  I note, though, that REASSIGN
OWNED's documentation mentions "objects in the current database"; but in
spirit, the point of it is to drop users.  So applying to shared objects
seems within charter to me.

So what this patch does, is ensure that both REASSIGN OWNED and DROP
OWNED operate on shared objects: the former changes ownership of those
shared objects to the target user; and the latter removes granted
privileges on those shared objects.


This is the patch for the master branch; I have not tried to backpatch
it yet.  Conflicts are expected due to the refactoring of ALTER commands
by KaiGai.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: cache lookup failed from empty plpythonu function
Next
From: Andres Freund
Date:
Subject: Re: cache lookup failed from empty plpythonu function