Re: REASSIGN OWNED BY alters objects in other database.

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REASSIGN OWNED BY alters objects in other database.
Date: 2025-12-30 15:14:41
Message-ID: CALdSSPgM0y3qc_m=gmdWkvQtCgJLi7JWCOo3Ey0rnFQFOH2X2g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 30 Dec 2025, 19:30 Álvaro Herrera, <alvherre(at)kurilemu(dot)de> wrote:

> On 2025-Dec-30, Kirill Reshke wrote:
>
> > So, REASSIGN OWNER executed in database postgres alters subscription
> > owner, which is created in another database. I am not myself confident
> > that this is actually wrong... Is this a bug?
>
> Subscriptions are shared objects (like tablespaces, roles etc), so I
> think this is working as intended.
>
> --
> Álvaro Herrera 48°01'N 7°57'E —
> https://www.EnterpriseDB.com/
> "I love the Postgres community. It's all about doing things _properly_.
> :-)"
> (David Garamond)
>

Yep, they are shared, but subscriptions are created in database context...
So, let me give some more context here

I want to delete user, which has subscription s1 in db1 and subscription s2
in db2. I want to REASSIGN all object from db1 to db1 owner and same for
db2.
I will do REASSIGN OWNED BY ... to <db owner> in each of these database,
and then drop user. I excpect that sql I do in db1 does not affect objects
in db2... Am I wrong in this assumption? Like, subscriptions have knowledge
of which database they are belong... maybe we should use this knowledge

>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-12-30 15:25:00 Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()
Previous Message Matheus Alcantara 2025-12-30 15:04:45 Re: Asynchronous MergeAppend