From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: currval() race condition on server? |
Date: | 2006-10-23 22:32:06 |
Message-ID: | 453D42E6.8020102@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-jdbc |
Tom Lane wrote:
> Adriaan Joubert <a(dot)joubert(at)albourne(dot)com> writes:
>
>>For some bookkeeping purposes I need the new audit number back from the
>>update, so I submit a prepared statement through jdbc of the form
>>
>>UPDATE A SET ....; SELECT currval('ip_audit_seq');
>
>
> It's not possible to put two SQL commands into one prepared statement
> --- at least not for the normal server-side meaning of "prepared statement".
> I dunno what the JDBC driver is doing with this, but I wonder if it's
> silently dropping the UPDATE part :-(
The driver should split this query on the semicolons and send
Parse/Bind/Execute for each part, followed by a Sync at the end. If it
ends up using named statements due to JDBC statement reuse, it should
use a different name for each part. Of course there might be unknown
bugs in there, but it has been designed to handle this sort of compound
statement..
To the OP: Is autocommit on or off? Can you reproduce the problem with a
URL parameter of loglevel=2 and see what it looks like? (that'll
generate a trace protocol-level messages)
-O
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2006-10-24 02:22:01 | Log statements that generate an error only ... ? |
Previous Message | Leandro Guimarães dos Santos | 2006-10-23 17:51:00 | InitDB problem on Win2K Server |
From | Date | Subject | |
---|---|---|---|
Next Message | Adriaan Joubert | 2006-10-24 07:37:31 | Re: currval() race condition on server? |
Previous Message | Adriaan Joubert | 2006-10-23 15:25:47 | Re: currval() race condition on server? |