Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, "spam_eater(at)gmx(dot)net" <spam_eater(at)gmx(dot)net>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Subject: Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
Date: 2013-01-28 20:00:06
Message-ID: 20130128200005.GB4050@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane escribió:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > I disagree with this assessment, and propose the attached patch instead.
>
> +1 for this approach in HEAD ...
>
> > 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.
>
> ... but I'm worried that you'd need a substantially larger patch in back
> branches, and accordingly I'm not sure this is what to do in the back
> branches. Without that refactoring, you might need to duplicate more
> code, so it might be safer to just revert as Jeff suggested.

I had a look at what it'd take to backpatch. For REASSIGN OWNED, you're
right that it'd require some refactoring, and it's probably not
worthwhile (the code is not really all that complicated). However, for
DROP OWNED the proposed hunks apply fine. Only 8.3 needs a different
patch, but it's only because whitespace is different.

So what we would end up with, is that DROP OWNED works for shared
objects (i.e. grants on tablespaces and databases are revoked), but
REASSIGN OWNED does not; so you're forced to do ALTER
DATABASE/TABLESPACE SET OWNER.

Since it's the grants that are more likely to cause headaches than
ownership when trying to drop users, I suggest that applying those
patches is the most convenient. (We know that this is a real problem
because of the bug reports we've gotten.)

> The documentation also needs more work than what you suggest in your
> followup. The command reference pages should explicitly say that they
> operate on both objects in the current database and shared objects.
> Explicitly defining shared objects as databases and tablespaces
> wouldn't hurt any.
>
> It also strikes me that where you suggest "Because REASSIGN OWNED does
> not affect objects in other databases ...", it might be clearer to say
> "Because REASSIGN OWNED does not affect objects within other databases
> ...", which makes the idea of containment a little stronger.

Okay, I will revise those proposed docs changes.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-01-28 20:04:59 Re: Re: BUG #7748: "drop owned by" fails with error message: "unrecognized object class: 1262"
Previous Message Tom Lane 2013-01-28 16:09:11 Re: BUG #7832: incorrect summation of ipv6 addresses