From: | Csaba Nagy <nagy(at)ecircle-ag(dot)com> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | "ON(dot)KG" <skyer(at)on(dot)kg>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: duplicate key violates unique constraint |
Date: | 2005-06-13 15:58:52 |
Message-ID: | 1118678332.2720.27.camel@coppola.muc.ecircle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
That would work indeed. Bit I guess the savepoint solution will be the
simplest and fastest if the OP has or can install 8.0 version.
Cheers,
Csaba.
On Mon, 2005-06-13 at 17:49, Richard Huxton wrote:
> Csaba Nagy wrote:
> > [snip]
> >
> >>If you have more than one client, this can always happen. You have two
> >>choices:
> >> 1. Use a lock to stop two clients interacting like this
> >
> >
> > This won't work unless you make all the clients serialized, or you have
> > all the ip's already inserted in the data base... you can't lock on an
> > unknown key, otherwise the locking will also need to insert, and you're
> > back to the same race condition ;-)
>
> You can, however, have something more finely-grained than whole-table
> locking (assuming one IP updated/inserted at a time) by filling a dummy
> table with e.g. integers 0..255 and locking a row there based on (e.g.)
> the last octet of your target IP.
>
> --
> Richard Huxton
> Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-06-13 16:03:33 | Re: duplicate key violates unique constraint |
Previous Message | Richard Huxton | 2005-06-13 15:49:15 | Re: duplicate key violates unique constraint |
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-06-13 16:03:33 | Re: duplicate key violates unique constraint |
Previous Message | Richard Huxton | 2005-06-13 15:49:15 | Re: duplicate key violates unique constraint |