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

Re: Transaction control overhauling

From: Federico Di Gregorio <federico(dot)digregorio(at)dndg(dot)it>
To: psycopg(at)postgresql(dot)org
Subject: Re: Transaction control overhauling
Date: 2011-05-12 12:13:09
Message-ID: (view raw, whole thread or download thread mbox)
Lists: psycopg
On 12/05/11 13:57, Magnus Hagander wrote:
>> II. add a method conn.set_transaction(isolation_level=None,
>> > read_only=None, deferrable=None) allowing to change one or more of the
>> > transaction settings. Calling the method would terminate the current
>> > transaction and put the new settings in place. Note that there are
>> > several ways for implementing this:
> Ugh. Big -1 on the "terminate current transaction". First of all, I
> *assume* you mean ROLLBACK and not COMMIT. But even so, I think it's a
> much better idea to raise a local exception when trying to change it
> while inside a transaction.

That makes sense. Currently psycopg keeps track of the current
transaction level to be able to decide if to terminare the transaction
(with a ROLLBACK) or not. But that's less than optimal because the
result of set_transaction_isolation() depends both on internal state and
issued queries. Much much better to just raise an exception if inside a


Federico Di Gregorio                         federico(dot)digregorio(at)dndg(dot)it
Studio Associato Di Nunzio e Di Gregorio        
 The only thing I see is if you are pumping so much data into the
  database all the time when do you expect to look at it?
                                                        -- Charlie Clark

In response to


psycopg by date

Next:From: Daniele VarrazzoDate: 2011-05-12 12:52:47
Subject: Re: Transaction control overhauling
Previous:From: Magnus HaganderDate: 2011-05-12 11:57:02
Subject: Re: Transaction control overhauling

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