Re: REASSIGN OWNED BY alters objects in other database. - Mailing list pgsql-hackers

From Kirill Reshke
Subject Re: REASSIGN OWNED BY alters objects in other database.
Date
Msg-id CALdSSPgM0y3qc_m=gmdWkvQtCgJLi7JWCOo3Ey0rnFQFOH2X2g@mail.gmail.com
Whole thread Raw
In response to Re: REASSIGN OWNED BY alters objects in other database.  (Álvaro Herrera <alvherre@kurilemu.de>)
Responses Re: REASSIGN OWNED BY alters objects in other database.
List pgsql-hackers


On Tue, 30 Dec 2025, 19:30 Álvaro Herrera, <alvherre@kurilemu.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 

pgsql-hackers by date:

Previous
From: "Matheus Alcantara"
Date:
Subject: Re: Asynchronous MergeAppend
Next
From: Tom Lane
Date:
Subject: Re: lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()