title: Sync transactions between databases in PostgreSQL using dblink
body: <p>I would like to sync a set of tables between two databases, transparently without application code chages. My idea is to create triggers on insert, update and delete, in the source database tables to replicate the data using dblink to the dest. database tables seamlessly.</p>
  
  <p>The problem is that changes in the source tables are always done inside a transaction. The triggers automatically replicate changes in the dest. tables but if the source transaction is rolled back the dest. tables changes are not.</p>
  
  <p>Is there a way to automatically sync transaction begin and commit/rollback between the two databases? A trigger-like behavior would be ideal.</p>