From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adriaan Joubert <a.joubert@albourne.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: currval() race condition on server?
Date: Tue, 24 Oct 2006 10:18:21 -0400
Message-ID: <8427.1161699501@sss.pgh.pa.us> (raw)
In-Reply-To: <453DC2BB.70803@albourne.com>
References: <453CC859.8070306@albourne.com>
<23634.1161613423@sss.pgh.pa.us>
<453D42E6.8020102@opencloud.com>
<453DC2BB.70803@albourne.com>
Adriaan Joubert <a.joubert@albourne.com> writes:
> It feels an awful lot like a timing issue where the sequence
> number is retrieved, but there is a delay until currval can use it. I'm
> not sure how currval works.
There is no "timing issue" in currval --- the server is single-threaded
and it's simply not possible that currval wouldn't be aware of a
previous nextval.
The theory that sounds best to me is the one someone already mentioned
about your trigger having a code path that doesn't execute nextval.
Another straw to grasp at is connection pooling: are you using it,
if so is it conceivable that the SELECT is being issued on a different
connection than the UPDATE?
regards, tom lane
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-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, a.joubert@albourne.com, pgsql-jdbc@postgresql.org
Subject: Re: currval() race condition on server?
In-Reply-To: <8427.1161699501@sss.pgh.pa.us>
References: <453CC859.8070306@albourne.com> <23634.1161613423@sss.pgh.pa.us> <453D42E6.8020102@opencloud.com> <453DC2BB.70803@albourne.com> <8427.1161699501@sss.pgh.pa.us>
* 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