On Fri, Dec 4, 2026 at 1:56 AM Masahiko Sawada <[email protected]> wrote:
>
> On Tue, Dec 1, 2026 at 3:56 AM Nisha Moond <[email protected]> wrote:
> >
> > On Tue, Dec 1, 2026 at 12:42 PM Nisha Moond <[email protected]> 
> > wrote:
> > >
> > > On Sat, Nov 21, 2026 at 12:05 AM Masahiko Sawada <[email protected]> 
> > > wrote:
> > > >
> > > > On Wed, Nov 18, 2026 at 4:48 PM Ajin Cherian <[email protected]> wrote:
> > > > >
> > > >
> > > > Given that we’ve agreed on the 0001 patch, I’m going to push it early
> > > > next week, barring any objections. I’d like to hold off on the 0002
> > > > patch to give it more review time.
> > > >
> > >
> > >
> > > Hi Sawada-san,
> > >
> > > I've started reviewing/testing the hook patch (v10-002)
> >
> > On further review, I found that GUC changes made by the handler stay
> > in the apply worker after it returns.
> > For example, if the handler runs a script with "SET search_path =
> > public, pg_catalog", later changes are applied with that path instead
> > of the empty one, so an unqualified upper() in a trigger may resolve
> > to public.upper() rather than the built-in. The same goes for other
> > GUCs, e.g. session_replication_role or synchronous_commit.
> >
> > When a later transaction fails due to this, the worker recovers after
> > the restart, as the GUCs are reset. But if the SET and the failing
> > change are in the same remote transaction, the handler runs the SET
> > again on every retry, and the worker fails in a loop.
> >
> > It depends on how the handler is written, so it may be rare, but I
> > could reproduce the loop with an ALWAYS trigger on the subscriber that
> > calls upper() unqualified, and a public.upper() that raises error
> > (steps attached).
> >
> > Maybe we can undo the handler's GUC changes, as below?
>
> I'm not sure we should have such a treatment for this hook. IIUC it's
> an extension responsibility. We have a number of hook functions but no
> one ensures to restore the changed GUC parameters.
>

Fair point. Then maybe a short note in the hook comment would help,
say that the handler should restore any GUC it changes, since
otherwise it affects how later changes are applied. The comment
already mentions the empty search_path, so it could go next to that.

--
Thanks,
Nisha


Reply via email to