Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 023F3F5C18C for ; Sat, 12 May 2012 11:28:34 -0300 (ADT) Received: from [76.14.161.106] (helo=newserver.jfcomputer.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1STDJA-0007AS-ES for pgsql-sql@postgresql.org; Sat, 12 May 2012 14:28:33 +0000 Received: from localhost (unknown [127.0.0.1]) by newserver.jfcomputer.com (Postfix) with ESMTP id B13C11224E for ; Sat, 12 May 2012 14:28:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at site Received: from newserver.jfcomputer.com ([127.0.0.1]) by localhost (linux-jfp8.site [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d1fQUK6NH0rU for ; Sat, 12 May 2012 07:28:17 -0700 (PDT) Received: from linux-12.localnet (unknown [192.168.1.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johnf@jfcomputer.com) by newserver.jfcomputer.com (Postfix) with ESMTPSA id 1D6C812215 for ; Sat, 12 May 2012 07:28:17 -0700 (PDT) From: John Fabiani To: pgsql-sql@postgresql.org Subject: syncing - between databases Date: Sat, 12 May 2012 07:28:16 -0700 Message-ID: <1545853.rUp5XqBn04@linux-12> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.9-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Host-Lookup-Failed: Reverse DNS lookup failed for 76.14.161.106 (failed) X-Pg-Spam-Score: 1.6 (+) X-Archive-Number: 201205/23 X-Sequence-Number: 36571 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, Johnf