Re: Atomic operations?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Paul Tomblin <ptomblin(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Atomic operations?
Date: 2008-03-18 23:18:19
Message-ID: 47E04DBB.8010801@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2008-03-19 11:25:40 Re: Atomic operations?
Previous Message Oliver Jowett 2008-03-18 23:15:55 Re: setQueryTimeout problem !?!?!