X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4F8A89DC9FA for ; Tue, 28 Feb 2006 15:07:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88565-01 for ; Tue, 28 Feb 2006 15:07:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id D41D99DC876 for ; Tue, 28 Feb 2006 15:07:25 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k1SJ7MS1076704 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 Feb 2006 12:07:25 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id k1SJ7MGb006612; Tue, 28 Feb 2006 12:07:22 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k1SJ7L8b006611; Tue, 28 Feb 2006 12:07:21 -0700 (MST) (envelope-from mfuhr) Date: Tue, 28 Feb 2006 12:07:21 -0700 From: Michael Fuhr To: Eugene Prokopiev Cc: pgsql-interfaces@postgresql.org Subject: Re: Python psycopg transaction isolation level Message-ID: <20060228190721.GA6495@winnie.fuhr.org> References: <44049611.8050300@stc.donpac.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44049611.8050300@stc.donpac.ru> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.122 required=5 tests=[AWL=0.122] X-Spam-Score: 0.122 X-Spam-Level: X-Archive-Number: 200602/89 X-Sequence-Number: 6053 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