Re: Logical replication and AFTER UPDATE triggers [PG 16] - Mailing list pgsql-general

From Chris Angelico
Subject Re: Logical replication and AFTER UPDATE triggers [PG 16]
Date
Msg-id CAPTjJmogtGWxmwkyZQC1VJ_LMtR4AHVOQvENXy3CUJiVcCUVfQ@mail.gmail.com
Whole thread Raw
In response to Logical replication and AFTER UPDATE triggers [PG 16]  (Chris Angelico <rosuav@gmail.com>)
List pgsql-general
On Fri, 2 Feb 2024 at 13:20, Chris Angelico <rosuav@gmail.com> wrote:
> create or replace function send_settings_notification() returns
> trigger language plpgsql as $$begin perform
> pg_notify('stillebot.settings', ''); return null; end$$;
> create trigger settings_update_notify after update on
> stillebot.settings execute function send_settings_notification();
> alter table stillebot.settings enable always trigger settings_update_notify;
>

Ah ha! A discovery. It may be that a FOR EACH STATEMENT trigger (which
is the default) does not fire on the subscriber. Converting to FOR
EACH ROW seems to make this function. Does this seem reasonable? I
can't find anything in the docs that confirms it.

ChrisA



pgsql-general by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Re: vacuum freeze wait_event BufferPin
Next
From: Lok P
Date:
Subject: How to do faster DML