Re: BUG #18625: user-created extensions change ownership to "postgres" after upgrade

From: Evgeni Golov <evgeni(at)golov(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18625: user-created extensions change ownership to "postgres" after upgrade
Date: 2024-09-20 15:02:12
Message-ID: wx6ndvw2ukpz2neoa2hkhldrrcfowlvyha4x7h746i4u73bjwp@l2vk2enhuwxf
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 20, 2024 at 10:16:32AM GMT, Tom Lane wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > when upgrading 15 to 16 (but also observed the same on 12 to 13), an
> > extension that was previously created by a "normal" user is now owned by
> > "postgres":
>
> Yeah, this is a known shortcoming --- pg_dump doesn't make any effort
> to preserve ownership of extensions. Nobody's really been motivated
> to do something about that.

:/

There is also no way for the user to update that ownership on their own,
after that happened, right?

foreman=> update pg_extension set extowner=16384 where extname='cube';
ERROR: permission denied for table pg_extension

Background: my app uses "DROP OWNED BY CURRENT_USER CASCADE;" to clean
the DB (and then start fresh), which now (obviously) fails as the
extension is not owned and thus not dropped. But a type defined by the
extenion is still owned and is tried to be dropped, which leads to
errors.

I guess the same would also apply to any "ALTER EXTENSION … UPDATE" etc
calls by the user, which would now be denied.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-09-20 16:18:00 Re: BUG #18625: user-created extensions change ownership to "postgres" after upgrade
Previous Message Tom Lane 2024-09-20 14:16:32 Re: BUG #18625: user-created extensions change ownership to "postgres" after upgrade