pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Hubbach <jeff.hubbach@cha.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Transaction atomicity
Date: Wed, 07 Mar 2007 09:25:51 -0700
Message-ID: <C214359F.1F08%jeff.hubbach@cha.com> (raw)
In-Reply-To: <1173283563.20645.53.camel@scarafaggio>


On 3/7/07 9:06 AM, "Giuseppe Sacco" <giuseppe@eppesuigoccas.homedns.org>
wrote:
> You are right, but I need different sequences for every user, i.e., if
> two users insert on the same table then I need a way to use different
> sequence. The reason of this is that I have to split my application into
> a few different postgresql instances based in different offices. Every
> night all instances synchronise their data (this is and INSERT only
> table), so I need a different table sequence in every office (or group
> of users or single user).

Using select(max(id)) won't work in this case, either (if I'm understanding
your setup correctly).

So each office has its own postgresql instance. Then every night you copy
the data from all offices to all other offices. Therefore, that whole day,
inserts were made in each office instance with the same IDs, which will
cause duplicate key exceptions. Does each user in each office have their own
instance?

Why not have a compound key on this table, with an ID generated by a
sequence (one sequence, named the same, for each instance of PostgreSQL for
each office), and an Office ID that is static for each instance? Then the
merge/sync would go through without a hitch.

-- Jeff Hubbach




view thread (13+ messages)  latest in thread

Message-ID: <C214359F.1F08%jeff.hubbach@cha.com>
Permalink:  ../C214359F.1F08%25jeff.hubbach@cha.com/
Also on:    postgresql.org/message-id/C214359F.1F08%jeff.hubbach@cha.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: jeff.hubbach@cha.com
  Subject: Re: Transaction atomicity
  In-Reply-To: <C214359F.1F08%jeff.hubbach@cha.com>
  References: <1173283563.20645.53.camel@scarafaggio> <C214359F.1F08%jeff.hubbach@cha.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox