Re: Fix publisher-side sequence permission reporting

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Tristan Partin <tristan(at)partin(dot)io>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix publisher-side sequence permission reporting
Date: 2026-07-24 06:37:20
Message-ID: CALDaNm3LsUjW7PahuCsbYAxajSF+S328tw5E9rF0erdh7dKOXw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 20 Jun 2026 at 14:54, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Sat, Jun 20, 2026 at 1:38 AM Tristan Partin <tristan(at)partin(dot)io> wrote:
> > > Updated patches attached.
> >
> > Looks great! Thanks for fixing this.
>
> Thanks for the review! I've pushed the patches.

There was an issue reported by Noah at [1], finding-8
("Permission-denied sequences double-reported as 'missing on
publisher'"). This is a residual issue left by commit d4a657b. The
issue occurs when a sequence synchronization batch contains both a
sequence that was dropped on the publisher and another for which the
replication role lacks SELECT privilege. In that case, the
permission-denied sequence is reported twice: once as having
insufficient privileges on the publisher sequence and again as missing
on the publisher. The root cause is that get_and_validate_seq_info()
returns COPYSEQ_PUBLISHER_INSUFFICIENT_PERM before marking the
sequence as found on the publisher. As a result, if another sequence
in the same batch is genuinely missing, the post-commit scan also
classifies the permission-denied sequence as missing.

The attached patch fixes this by marking the sequence as found on the
publisher before returning COPYSEQ_PUBLISHER_INSUFFICIENT_PERM. Since
receiving a row from the publisher proves that the sequence exists
there, it should not also be reported as missing.

[1] - https://www.postgresql.org/message-id/20260710045217.f0.noahmisch%40microsoft.com

Regards,
Vignesh

Attachment Content-Type Size
v1-0001-Avoid-reporting-permission-denied-publisher-seque.patch application/octet-stream 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-07-24 06:43:04 Re: Build warning with meson and dtrace on Fedora 43
Previous Message Andrey Rachitskiy 2026-07-24 06:27:13 Re: Build warning with meson and dtrace on Fedora 43