Re: could not serialize access due to concurrent update - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: could not serialize access due to concurrent update
Date
Msg-id 1186781651.11237.233.camel@linda.lfix.co.uk
Whole thread Raw
In response to could not serialize access due to concurrent update  (Brian Hurt <bhurt@janestcapital.com>)
List pgsql-novice
On Fri, 2007-08-10 at 16:23 -0400, Brian Hurt wrote:
> Actually, I have something of a weird problem.  I'm trying to test some
> code of mine to handle cases where a retry is needed when working with
> serializable transactions.  My problem is that I can *not* figure out
> how to trigger this error:

...
> >ERROR:  could not serialize access due to concurrent update
> >

Session1: BEGIN;
Session2: BEGIN;
Session1: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Session2: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
Session1: SELECT * FROM tunnels WHERE un = 1 FOR UPDATE;
 un | password
----+----------
  1 | bugsy
(1 row)

Session1: UPDATE tunnels SET password = 'malone' WHERE un = 1;
Session2: SELECT * FROM tunnels WHERE un = 1 FOR UPDATE;
...waits on Session1's lock...
Session1: COMMIT;
Session2: ERROR:  could not serialise access due to concurrent update


--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
   Do you want to know God?   http://www.lfix.co.uk/knowing_god.html


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


pgsql-novice by date:

Previous
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Free designable front end for PostgreSQL
Next
From: "Lonni J Friedman"
Date:
Subject: analyzing query results