Skip site navigation (1) Skip section navigation (2)

Re: could not serialize access due to concurrent update

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Brian Hurt <bhurt(at)janestcapital(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: could not serialize access due to concurrent update
Date: 2007-08-10 21:34:11
Message-ID: 1186781651.11237.233.camel@linda.lfix.co.uk (view raw or flat)
Thread:
Lists: 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(at)lfix(dot)co(dot)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.


In response to

pgsql-novice by date

Next:From: Jim StalewskiDate: 2007-08-10 21:45:30
Subject: Re: Free designable front end for PostgreSQL
Previous:From: Andrej Ricnik-BayDate: 2007-08-10 20:44:30
Subject: Re: Free designable front end for PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group