| From: | Zhijie Hou <houzhijie22(at)gmail(dot)com> |
|---|---|
| To: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com> |
| Subject: | Re: [PG19] Sequence sync stops when the subscription owner can't SET ROLE to a sequence owner |
| Date: | 2026-10-17 13:44:59 |
| Message-ID: | CAFvd2n-Qhjk6ZL0byBFhqKe_t1-fguzQ7Q6Eh2WmRjF14Y2JKg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Sat, Oct 17, 2026 at 1:19 AM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> Hello
>
> With run_as_owner = false, copy_sequence switches to the sequence
> owner with SwitchToUntrustedUser before the UPDATE privilege check. If
> the subscription owner can't SET ROLE to that owner, it raises an
> ERROR and the whole batch is aborted.
...
>
> The comment in report_sequence_errors also seems to assume that with
> run_as_owner = false the switch always succeeds, and only the owner's
> UPDATE privilege can be missing.
>
> The attached patch checks member_can_set_role before switching and
> returns INSUFFICIENT_PERM if it fails. With it, the example above
> gives the WARNING for a2, and a1, a3, a4 are READY.
Thanks for the report and the patch. I personally agree it would be better to
improve this as suggested, though I'll leave it to the original author
to confirm.
I have one question on the patch:
+ * before checking privileges, and the problem can be either that the
+ * subscription owner cannot SET ROLE to the sequence owner or that
+ * the sequence owner lacks UPDATE, so no useful GRANT hint can be
+ * provided.
It's not clear to me why a useful GRANT hint can't be provided here. Without
the fix, the error message at least tells the user that the SET ROLE privilege
is missing, and names both the role and the member, whereas after the fix, the
information is no longer visible in the log. So I'm thinking maybe we could
emit a dedicated HINT for this case. Please see the attached top-up patch
for reference, in case others have the same feeling.
Best Regards,
Zhijie Hou
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot-v1-topup-0001-Add-hint-for-SET-ROLE-failure-during-sequence-syn.patch | application/octet-stream | 6.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | harrisontbooth | 2026-10-17 14:07:14 | Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows |
| Previous Message | Hannu Krosing | 2026-10-17 13:42:28 | [PATCH] Add immediate_global_insert_visibility GUC for immediate frozen inserts |