On Thu, Dec 1, 2022 at 7:29 PM Avi Weinberg <AviW@gilat.com> wrote:
>
>
> There is no error or warning when creating FOR EACH STATEMENT trigger on Logical Replication subscriber side, but it
isnot 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.