Re: REASSIGN OWNED BY alters objects in other database.

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REASSIGN OWNED BY alters objects in other database.
Date: 2026-01-05 19:10:53
Message-ID: B5E2328B-7759-4EF9-9541-256F955C8895@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 2 Jan 2026, at 01:41, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> I can see that REASSIGN owned will behave the way I want if the `dbid`
> column in pg_shdepend would be non-zero for record with deptype = 'o'
> (owner).
> This would automatically drop only subscriptions from the current
> database. But we create this record with dbid = 0 because of
> shdepAddDependency, which thinks that classId is a shared relation
> then dependency should have dbid = 0. I wonder if this is correct (for
> subscriptions case).
>
> If it is, then your patch WFM LGTM.

After considering your approach a bit more, I started to think that what you propose might be a better option for master branch.

While looking up into pg_subscription is much easier to backpatch, making dbid real in pg_shdepend might be more future proof.
But there might be some consequences that I do not understand now.

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-01-05 19:16:34 Re: Support getrandom() for pg_strong_random() source
Previous Message Alexander Law 2026-01-05 19:00:00 Re: Typos in the code and README