Notify from trigger on pglogical replicated table

2019-07-26 16:46发布

问题:

I'm trying to setup a push-from-server functionality based on PostgreSQL, pglogical and PostgreSQL's listen-notify mechanism. On my replicated table I've setup a trigger that uses pg_notify to push messages to queue after insert. Altered the trigger to "enable always trigger". With this setup, the behavior is not what I expected.

After setting up a listen client (another postgresql console, also tried multiple python drivers, behavior is always the same), I don't get the notifications until I send another notification from another process that is not triggered by replication. Once I send the notification by hand, I get all the notifications pushed from the trigger alongside the one I've sent manually.

Any help appreciated.

回答1:

This is a bug with PostgreSQL. NOTIFY's coming from triggers that are triggered by logical replication don't properly trigger notifications. It's getting worked on.

Followed here from this question.