Re: [BUGS] 10.0: Logical replication doesn't execute BEFORE UPDATEOF trigger - Mailing list pgsql-bugs

From Aleksander Alekseev
Subject Re: [BUGS] 10.0: Logical replication doesn't execute BEFORE UPDATEOF trigger
Date
Msg-id 20171010102613.GA28161@e733.localdomain
Whole thread Raw
In response to Re: [BUGS] 10.0: Logical replication doesn't execute BEFORE UPDATE OF trigger  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-bugs
Hi Masahiko,

> > I think the cause of this issue is that the apply worker doesn't set
> > updatedCols of RangeTblEntry when applying updates. So TriggerEnabled
> > always ends up with false. I'll make a patch and submit.
> >
>
> Attached patch store the updated columns bitmap set to RangeTblEntry.
> In my environment this bug seems to be fixed by the patch.

Thanks a lot for a quick response. I can confirm that your patch fixes
the issue and passes all tests. Hopefully someone will merge it shortly.

Here is another patch from me. It adds a corresponding TAP test. Before
applying your patch:

```
t/001_rep_changes.pl .. ok
t/002_types.pl ........ ok
t/003_constraints.pl .. 1/5
#   Failed test 'check replica trigger with specified list of affected columns applied on subscriber'
#   at t/003_constraints.pl line 151.
#          got: 'k2|v1'
#     expected: 'k2|v1
# triggered|true'
# Looks like you failed 1 test of 5.
t/003_constraints.pl .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/5 subtests
t/004_sync.pl ......... ok
t/005_encoding.pl ..... ok
t/006_rewrite.pl ...... ok
t/007_ddl.pl .......... ok
```

After:

```
t/001_rep_changes.pl .. ok
t/002_types.pl ........ ok
t/003_constraints.pl .. ok
t/004_sync.pl ......... ok
t/005_encoding.pl ..... ok
t/006_rewrite.pl ...... ok
t/007_ddl.pl .......... ok
All tests successful.
```

--
Best regards,
Aleksander Alekseev

Attachment

pgsql-bugs by date:

Previous
From: Josef Machytka
Date:
Subject: Re: [BUGS] BUG #14845: postgres_fdw and mysql_fdw can cause crash of instance
Next
From: Giovanni Pisante | Danysoft
Date:
Subject: Re: [BUGS] please quote POSTGRESQL