Re: [BUGS] BUG #14699: Statement trigger and logical replication

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Константин Евтеев <konst583(at)gmail(dot)com>
Subject: Re: [BUGS] BUG #14699: Statement trigger and logical replication
Date: 2017-06-17 01:51:53
Message-ID: CAEepm=16_11pgGAXV56MmkK9YG+LDZY9HEpv1q=LjVs+GHMhug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Sat, Jun 17, 2017 at 1:22 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2017-06-16 21:08:44 -0400, Peter Eisentraut wrote:
>> On 6/16/17 09:13, Константин Евтеев wrote:
>> > 2017-06-13 5:57 GMT+03:00 Peter Eisentraut
>> > <peter(dot)eisentraut(at)2ndquadrant(dot)com
>> > <mailto:peter(dot)eisentraut(at)2ndquadrant(dot)com>>:
>> >
>> > I think this is all working correctly and as intended.
>> >
>> > But then, why data copy for init logical replication fires statement
>> > trigger. May be it is also not nedeed?
>> > Or this feature needs to be mentioned in documentation?
>>
>> I don't know. Hackers?
>>
>> The issue is that the logical replication initial data copy fires a
>> statement trigger for INSERT, because it's implemented as a COPY internally.
>>
>> By contrast, the normal apply worker does not fire any statement
>> triggers (because they are not "statements").
>>
>> We could adjust one or the other or leave it as is.
>
> Leave it as is.

I also noticed this while working on the open items for transition
tables. One of my patches adds a comment to execReplication.c about
the need to do a bit more work if/when statement triggers are fired
here in future. I assume that we'll eventually want statement
triggers to fire if eager incremental matviews depend on that (as is
proposed), or if that set-oriented FK check idea goes somewhere.
Transition tables make statement triggers a lot more powerful
(something like batch-mode after row triggers).

--
Thomas Munro
http://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira 2017-06-17 12:29:37 Re: [BUGS] BUG #14699: Statement trigger and logical replication
Previous Message Andres Freund 2017-06-17 01:22:34 Re: [BUGS] BUG #14699: Statement trigger and logical replication

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2017-06-17 01:58:43 Re: how are the rpms configured that are available in PostgreSQL RPM Building Project - Yum Repository
Previous Message Peter Eisentraut 2017-06-17 01:27:01 Re: Getting server crash on Windows when using ICU collation