BUG #16544: How to identify trigger is called from the node where row is created? - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16544: How to identify trigger is called from the node where row is created?
Date
Msg-id 16544-e3b4bf68c80321d1@postgresql.org
Whole thread Raw
Responses Re: BUG #16544: How to identify trigger is called from the node where row is created?
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16544
Logged by:          sat
Email address:      satishcampus@gmail.com
PostgreSQL version: 12.3
Operating system:   Debian
Description:

In BDR cluster, I have multiple nodes say A and B and it has table named
'config'. 

I have created trigger (config_trigger) to listen on the table 'config'
(when CRUD operation) and the trigger is also replicated on all cluster
nodes.

Using CRUD REST, any operation can be perform on 'config' table.

On REST POST call (say on node A), I am executing some BL (say  a+b) and
saving data into the table. Since my requirement is to execute (a+b) on all
other nodes available in the cluster, I am executing BL of (a+b) from the
config_trigger. In that case, the node B will also executes (a+b).

But the issue is, node A's trigger also executes (a+b). I want to avoid it,
since in POST call it is already executed.

Is there any way, when trigger gets called, check for the source of
replication from which node? 
Or identify the trigger is called after replication happen, not on create
operation.


pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #16526: pg_test_fsync in v12 doesn't run in Windows
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #16544: How to identify trigger is called from the node where row is created?