Skip site navigation (1) Skip section navigation (2)

syncing - between databases

From: John Fabiani <johnf(at)jfcomputer(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: syncing - between databases
Date: 2012-05-12 14:28:16
Message-ID: 1545853.rUp5XqBn04@linux-12 (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
I need to maintain a sync-ed table across several databases.  For example I 
have a customer table in 5 databases.  If a user of any of the databases 
inserts a new customer I need to insert the new record into the other four 
databases.  But question is updates and deletes.

I can use a trigger and dblink to update the other databases when the action 
is an insert because in each of the other databases I don't have to worry 
about a locked record.  But what happens if a user is updating at the same 
moment as a different user in a different database is updating the same 
customer.  Can a race condition occur?

I was thinking I could create a master database.  And have all the other 
databases use dblink to excute the master trigger. 

Any advise would be helpful,



pgsql-sql by date

Next:From: Steven CrandellDate: 2012-05-13 03:53:52
Subject: Re: syncing - between databases
Previous:From: Jasen BettsDate: 2012-05-11 21:59:45
Subject: Re: Finding Max Value in a Row

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group