BUG #16544: How to identify trigger is called from the node where row is created?

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: satishcampus(at)gmail(dot)com
Subject: BUG #16544: How to identify trigger is called from the node where row is created?
Date: 2020-07-16 04:54:58
Message-ID: 16544-e3b4bf68c80321d1@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16544
Logged by: sat
Email address: satishcampus(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2020-07-16 05:31:34 Re: BUG #16544: How to identify trigger is called from the node where row is created?
Previous Message Bruce Momjian 2020-07-15 16:26:53 Re: BUG #16526: pg_test_fsync in v12 doesn't run in Windows