I am working on two way sync between two databases, something like what cloudconnect.com
did. I am using DB triggers to send data back and forth between the DB's. I was wondering whether I could prevent the PG database in the local from calling the update trigger when the update is done from the remote DB (preventing continuous looping).
I tried using SET session_replication_role: 'replica'
, which worked, but this will also violate the database integrity by disabling the column constrains.
I was then thinking to have a extra field called disable_trigger
and set it to true in the query in which I want the trigger to not happen. But I don't want to change the schema of the database.
Can anyone suggest a way to do this?