Thread

  1. Re: REASSIGN OWNED BY alters objects in other database.

    Kirill Reshke <reshkekirill@gmail.com> — 2025-12-30T15:14:41Z

    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
    
    >