pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Eugene Prokopiev <prokopiev@stc.donpac.ru>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Python psycopg transaction isolation level
Date: Tue, 28 Feb 2006 12:07:21 -0700
Message-ID: <20060228190721.GA6495@winnie.fuhr.org> (raw)
In-Reply-To: <44049611.8050300@stc.donpac.ru>
References: <44049611.8050300@stc.donpac.ru>

On Tue, Feb 28, 2006 at 09:27:29PM +0300, Eugene Prokopiev wrote:
> connection = psycopg.connect("host="+server+" dbname="+database+" 
> user="+login+" password="+password)
> cursor_modify = connection.cursor()
> cursor_modify.execute("update messages set flag=1 where flag=0")
> connection.commit()
> 
> On running it sometimes I got:
> 
> psycopg.ProgrammingError: ERROR:  could not serialize access due to 
> concurrent update

psycopg's default isolation level is SERIALIZABLE.  I think the way
to set the isolation level to READ COMMITTED is:

connection = psycopg.connect(...)
connection.set_isolation_level(1)

You'll find more psycopg expertise on the psycopg mailing list:

http://lists.initd.org/mailman/listinfo/psycopg

-- 
Michael Fuhr



view thread (2+ messages)

Message-ID: <20060228190721.GA6495@winnie.fuhr.org>
Permalink:  ../20060228190721.GA6495@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060228190721.GA6495@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: mike@fuhr.org, prokopiev@stc.donpac.ru
  Subject: Re: Python psycopg transaction isolation level
  In-Reply-To: <20060228190721.GA6495@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox