RE: [16] ALTER SUBSCRIPTION ... SET (run_as_owner = ...) is a no-op

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: RE: [16] ALTER SUBSCRIPTION ... SET (run_as_owner = ...) is a no-op
Date: 2023-09-11 03:26:27
Message-ID: OS0PR01MB57169684EDF6495B5152AF1C94F2A@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sunday, September 10, 2023 4:43 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>
>
> Repro:
> ALTER SUBSCRIPTION s1 SET (run_as_owner = true);
> SELECT subrunasowner FROM pg_subscription WHERE subname='s1';
> subrunasowner
> ---------------
> f
> (1 row)
>

Thanks for reporting. I can also reproduce the issue. I think it's because we
didn't reflect the option change on catalog. Here is a small patch 0001 to fix it.

> It also looks like a change to that field may not cause the subscription worker to
> restart. It would be good to add a test for that case.

Currently, the changes on run_as_owner won't cause the worker to restart
because we don't need to rebuild the connection in this case. The option change
will be caught by apply worker in next loop and the later changes will be
applied using the new option. the 0002 patch adds a test to verfiy it, just to
show how it behaves.

Best Regards,
Hou zj

Attachment Content-Type Size
0002-add-a-test-to-verify-the-change-of-runasowner-take-e.patch application/octet-stream 2.1 KB
0001-Ensure-that-the-update-on-run_as_owner-is-reflected-.patch application/octet-stream 4.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2023-09-11 03:29:00 Re: [16+] subscription can end up in inconsistent state
Previous Message Lepikhov Andrei 2023-09-11 03:15:02 Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause