Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 1A60E9FA4AE for ; Tue, 24 Oct 2006 13:20:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 50114-03 for ; Tue, 24 Oct 2006 16:20:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 8C2AF9FB3A8 for ; Tue, 24 Oct 2006 13:20:11 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from ankole.albourne.com (ankole.albourne.com [83.244.142.182]) by svr4.postgresql.org (Postfix) with ESMTP id AB6845AF039 for ; Tue, 24 Oct 2006 16:20:08 +0000 (GMT) Received: from mailhost.albourne.com (angeln.intern.albourne.com [192.168.160.21]) by ankole.albourne.com (8.13.3/8.13.3) with ESMTP id k9OGK5OH023743 for ; Tue, 24 Oct 2006 16:20:05 GMT Received: from localhost ([127.0.0.1]) by mailhost.albourne.com for pgsql-jdbc@postgresql.org; Tue, 24 Oct 2006 17:20:04 +0100 To: pgsql-jdbc@postgresql.org From: "Adriaan Joubert" Reply-To: a.joubert@albourne.com Organization: Albourne Partners Ltd. Subject: =?iso-8859-1?Q?Re=3A_=5BJDBC=5D_currval=28=29_race_condition_on_se?= =?iso-8859-1?Q?rver=3F=20?= Message-ID: <20061024162004.3e08f577@mailhost.albourne.com> Date: Tue, 24 Oct 2006 17:20:04 +0100 X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-----------867149d424f0a6aed7723b9dd0b1329e" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.482 tagged_above=0 required=5 tests=HTML_30_40, HTML_MESSAGE, SPF_SOFTFAIL, SUBJECT_ENCODED_TWICE, SUBJECT_EXCESS_QP X-Spam-Level: *** X-Archive-Number: 200610/109 X-Sequence-Number: 15992 This is a multi-part message in MIME format. -------------867149d424f0a6aed7723b9dd0b1329e Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 There is no "timing issue" in currval --- the server is single-threade= d and it's simply not possible that currval wouldn't be aware of a previous nextval.Thanks! That is good to know, as it makes clear that = the problem is elsewhere! =20 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=3F Yes, I am using a connection pool, but from the jdbc log it looks as i= f both statements are executed in a single trip to the backend, so this = leaves the trigger. Best guess, as you say, is that there is an error co= ndition somewhere in the trigger so that nextval is not executed. I'll h= ave another close look at the trigger code - it was written 6-7 years ag= o and only patched up for the new protocol version and to add the macros= required in 8.2, so it could do with a good going over. Thanks to everybody for all the help! Adriaan =20 -------------867149d424f0a6aed7723b9dd0b1329e Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

There is no "timing issue" in currval --- the server is single-threaded<= br> and it's simply not possible that currval wouldn't be aware of a
previous nextval.
Thanks! That is good to know, as it makes = clear that the problem is elsewhere!


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=3F
Yes, I am using a connection pool, but from the jdbc log it= looks as if both statements are executed in a single trip to the backen= d, so this leaves the trigger. Best guess, as you say, is that there is = an error condition somewhere in the trigger so that nextval is not execu= ted. I'll have another close look at the trigger code - it was written 6= -7 years ago and only patched up for the new protocol version and to add= the macros required in 8.2, so it could do with a good going over.
<= br>Thanks to everybody for all the help!

Adriaan

-------------867149d424f0a6aed7723b9dd0b1329e--