Re: Warning When Creating FOR EACH STATEMENT Trigger On Logical Replication Subscriber Side

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Warning When Creating FOR EACH STATEMENT Trigger On Logical Replication Subscriber Side
Дата
Msg-id CAA4eK1+32_hB6O2jz0ww6ympJB5UwofiyWa=Pq3g21RRdCB5WA@mail.gmail.com
обсуждение исходный текст
Ответ на Warning When Creating FOR EACH STATEMENT Trigger On Logical Replication Subscriber Side  (Avi Weinberg <AviW@gilat.com>)
Список pgsql-hackers
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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Missing MaterialPath support in reparameterize_path_by_child
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Failed Assert while pgstat_unlink_relation