Re: REASSIGN OWNED BY alters objects in other database.

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REASSIGN OWNED BY alters objects in other database.
Date: 2026-01-01 16:51:20
Message-ID: 202601011635.6rfmtndnltdv@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Dec-30, Kirill Reshke wrote:

> Yep, they are shared, but subscriptions are created in database context...

True.

> 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

Yeah, I can see that there is merit to this idea, and I think it's not
very difficult to implement -- POC attached. Does this solve your
issue?

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/

Attachment Content-Type Size
0001-REASSIGN-OWNED-ignore-subscriptions-in-other-databas.patch text/x-diff 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-01-01 17:16:05 Re: Implement waiting for wal lsn replay: reloaded
Previous Message Andrew Dunstan 2026-01-01 16:45:26 Re: Non-text mode for pg_dumpall