Thread: How to identify trigger is called from the node where row is created

How to identify trigger is called from the node where row is created

From
Satish S
Date:
Hi,

I have a cluster of three nodes A, B, C and I'm using postgres bdr for replication.

I have some code to execute after a value change in the table, for this I have added a trigger.

When I call POST REST API from any one of the nodes it will execute the code, and on all other nodes the trigger will execute the code. The issue is the trigger will execute the code on the same node as well where POST call is happening.

Ex. POST REST API on node B. Directly execute a+b. save a and b in DB. response

Trigger activates on all nodes. And it will execute a+b on all nodes. (but I don't want to execute it again on node B)

Re: How to identify trigger is called from the node where row is created

From
"David G. Johnston"
Date:
On Thu, Jul 16, 2020 at 1:16 AM Satish S <satishcampus@gmail.com> wrote:

I have a cluster of three nodes A, B, C and I'm using postgres bdr for replication

This isn’t the right mailing list for this topic.  Core PostgreSQL doesn’t have BDR so this seems like it should be directed to whichever product is providing that capability.  I’m pretty sure that nothing in core PostgreSQL ties nodes to data.  But if you want to explore this on the community lists you want to send to the -general list, not -hackers.  Per our community mailing list listing:

 
"The PostgreSQL developers team lives here. Discussion of current development issues, problems and bugs, and proposed new features. If your question cannot be answered by people in the other lists, and it is likely that only a developer will know the answer, you may re-post your question in this list. You must try elsewhere first!"

David J.