Re: Atomic operations? - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Atomic operations?
Date
Msg-id 47E04DBB.8010801@opencloud.com
Whole thread Raw
In response to Re: Atomic operations?  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: Atomic operations?  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
Dave Cramer wrote:
>
> On 18-Mar-08, at 9:40 AM, Paul Tomblin wrote:

>>   PreparedStatement ps = conn.prepareStatement(
>>      "DELETE FROM venue WHERE venueid = ? ; INSERT INTO VENUE
>> (venueid, .... ) VALUES(?, ?, ?, ?)");

>> Does that work?  Will that be atomic so that nobody else can insert
>> one with that venueid in between the delete and the insert?
>>
> I don't think so,

Actually it's fine the implicit transaction created by the server to
support autocommit wraps both queries in a single transaction and does
not commit/rollback until the end of the second query.

-O


pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: setQueryTimeout problem !?!?!
Next
From: Dave Cramer
Date:
Subject: Re: Atomic operations?