Re: Logical replication and AFTER UPDATE triggers [PG 16]

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Logical replication and AFTER UPDATE triggers [PG 16]
Date: 2024-02-03 06:06:35
Message-ID: CAPTjJmogtGWxmwkyZQC1VJ_LMtR4AHVOQvENXy3CUJiVcCUVfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2 Feb 2024 at 13:20, Chris Angelico <rosuav(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lok P 2024-02-03 12:20:02 How to do faster DML
Previous Message Greg Sabino Mullane 2024-02-03 01:15:39 Re: vacuum freeze wait_event BufferPin