From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Avi Weinberg <AviW(at)gilat(dot)com> |
Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Warning When Creating FOR EACH STATEMENT Trigger On Logical Replication Subscriber Side |
Date: | 2022-12-02 02:55:41 |
Message-ID: | CAA4eK1+32_hB6O2jz0ww6ympJB5UwofiyWa=Pq3g21RRdCB5WA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Dec 1, 2022 at 7:29 PM Avi Weinberg <AviW(at)gilat(dot)com> wrote:
>
>
> There is no error or warning when creating FOR EACH STATEMENT trigger on Logical Replication subscriber side, but it is not doing anything. Shouldn't a warning be helpful?
>
>
>
> CREATE TRIGGER set_updated_time_trig
>
> AFTER INSERT OR UPDATE OR DELETE ON test
>
> FOR EACH STATEMENT EXECUTE FUNCTION set_updated_time();
>
I think we need to consider a few things for this. First, how will we
decide whether a particular node is a subscriber-side? One can create
a subscription after creating the trigger. Also, it won't be
straightforward to know whether the particular table is involved in
the replication. Second, the statement triggers do get fired during
initial sync, see docs [1] (The logical replication apply process
currently only fires row triggers, not statement triggers. The initial
table synchronization, however, is implemented like a COPY command and
thus fires both row and statement triggers for INSERT.). So,
considering these points, I don't know if it is worth showing a
WARNING here.
[1] - https://www.postgresql.org/docs/devel/logical-replication-architecture.html
--
With Regards,
Amit Kapila.
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2022-12-02 03:23:28 | Re: Failed Assert while pgstat_unlink_relation |
Previous Message | Tom Lane | 2022-12-02 02:55:23 | Missing MaterialPath support in reparameterize_path_by_child |