Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ? - Mailing list pgsql-general

From Melvin Davidson
Subject Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?
Date
Msg-id CANu8FizoFoWnBWUQpugSNMUsUQxjoX_3yjtpMmXSYQ0weo__cA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general


On Wed, Aug 9, 2017 at 1:56 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wed, Aug 9, 2017 at 10:37 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Scott Marlowe <scott.marlowe@gmail.com> writes:
> Seems like something that should be handled by alter doesn't it?

I have some vague memory that we intentionally didn't implement
ALTER EXTENSION OWNER because we were unsure what it ought to do
about ownership of objects belonging to the extension.  If the answer
is "nothing" then it wouldn't be hard to add such a statement.

The documented contract of CREATE EXTENSION(1)/ALTER EXTENSION ADD MEMBER(2) requires that the extension owner and the owner of the member objects be one-and-the-same (I suppose the inclusion of DROP in (2) makes this debatable).  I do not know what happens today if someone tries to ALTER OBJECT SET OWNER on a member object to a role other than the owner of the extension.  From the docs I'd suggest that it should fail.  Likewise, ALTER EXTENSION OWNER should cascade to all members - which (3), and normal dependency tracking, seems to make straight-forward.

1>The user who runs CREATE EXTENSION becomes the owner of the extension for purposes of later privilege checks, as well as the owner of any objects created by the extension's script.

2>You must own the extension to use ALTER EXTENSION. The ADD/DROP forms require ownership of the added/dropped object as well.

3>CREATE EXTENSION additionally records the identities of all the created objects, so that they can be dropped again if DROP EXTENSION is issued.

David J.


David,

The problem is, The current owner of the extension needs to be dropped. No one should have to jump through hoops
just to be able to do that. There is definitely a need for an ALTER EXTENSION name OWNER TO new_owner.

As Tom Lane has already pointed out, it would not be hard to add that.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

pgsql-general by date:

Previous
From: Andres Freund
Date:
Subject: Re: [GENERAL] Multixact members limit exceeded
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] How to ALTER EXTENSION name OWNER TO new_owner ?