Re: currval() race condition on server?

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: currval() race condition on server?
Дата
Msg-id 453D42E6.8020102@opencloud.com
обсуждение исходный текст
Ответ на Re: currval() race condition on server?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: currval() race condition on server?
Список pgsql-jdbc
Tom Lane wrote:
> Adriaan Joubert <a.joubert@albourne.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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Adriaan Joubert
Дата:
Сообщение: Re: currval() race condition on server?
Следующее
От: Adriaan Joubert
Дата:
Сообщение: Re: currval() race condition on server?