From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: cpacejo@clearskydata.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13666: REASSIGN OWNED BY doesn't affect the relation underlying composite type
Date: Fri, 11 Dec 2015 19:30:25 -0300
Message-ID: <20151211223025.GX2763@alvherre.pgsql> (raw)
In-Reply-To: <20151007170154.GB4405@alvherre.pgsql>
References: <20151007142530.8425.57690@wrigleys.postgresql.org>
<20151007170154.GB4405@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Alvaro Herrera wrote:
> cpacejo@clearskydata.com wrote:
> > =# REASSIGN OWNED BY user1 TO user2;
> >
> > =# SELECT typowner, relowner FROM pg_type JOIN pg_class ON typrelid =
> > relfilenode WHERE typname = 'foo';
> > -[ RECORD 1 ]---
> > typowner | 8713825
> > relowner | 16384
>
> Hmm. I guess we're missing a recursion step somewhere. I would have
> assumed that the pg_class entry would also have a dependency on the
> owner and should would have been visited in the initial loop. Strange.
I think I see what's going on here: in AlterTypeOwner the code calls
ATExecChangeOwner when it detects a composite type to start the
modification starting from the type relation's, from where it cascades
onto the type itself. However, AlterTypeOwnerInternal hasn't heard of
this trick and just changes itself and the array entry, so the pg_class
entry is not modified.
I think the bug is that shdepReassignOwned shouldn't be calling
AlterTypeOwnerInternal directly, because that routine is not of a high
enough level. We need another routine sitting between AlterTypeOwner
and AlterTypeOwnerInternal which does the real work for the former
(including calling ATExecChangeOwner for composites), after looking up
the type OID from the name list; then shdepReassignOwned should call
that new intermediate function.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alvherre@2ndquadrant.com, cpacejo@clearskydata.com
Subject: Re: BUG #13666: REASSIGN OWNED BY doesn't affect the relation underlying composite type
In-Reply-To: <20151211223025.GX2763@alvherre.pgsql>
References: <20151007142530.8425.57690@wrigleys.postgresql.org> <20151007170154.GB4405@alvherre.pgsql> <20151211223025.GX2763@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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