Re: Transactions, cursors and timestamps

Terry Macdonald <[email protected]> Tue, 04 Apr 2006 10:24:27 +0100
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
Billy G. Allie wrote:
> On Sun, 2006-04-02 at 19:25 +0100, Terry Macdonald wrote:
>> Billy G. Allie wrote:
>> > On Mon, 2006-03-27 at 13:52 +0100, Terry Macdonald wrote:
>> >> Hi,
>>     
>     [ . . . ]
>> >
>> If I have understood you then If I have a single cursor on a connection 
>> I would need to do a commit after every select so that a subsequent 
>> insert or update would have a correct timestamp.
>> Or...
>> I could have two connections each with a cursor; one connection/cursor 
>> pair would be used for non-select statements and the other 
>> connection/cursor pair would be used for selects
>>
>> Yes?
>>
>>     
> Either would work (providing that the onnection/cursor pair used for 
> inserts and updates is commited frequently enough to make the 
> timestamps reflect the current time.
>
> /Note that the restrictions of one active transaction per connection 
> is a PostgreSQL restriction, not a DB-API  2.0 compilant module 
> restriction./ 
I will be using a hack for now whereby for a non-select query a commit 
is performed before and after execution as the cursor is also used for 
select queries so a transaction is in progress pretty much the whole time.

Has no one else experienced this issue before?  I'm surprised it doesn't 
show up in the mailing list more often. Or am I doing things completely 
arse about face!

Do people open a new connection for every request?! surely not

Thanks for your help Billy.



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642