[PyGreSQL] Cached statements

D'Arcy J.M. Cain darcy at PyGreSQL.org
Tue May 2 12:13:35 EDT 2006


On Tue, 2 May 2006 15:20:23 +0100
Mark Lee <mark at geneity.co.uk> wrote:

> Hello. Firstly, I'm new to Python so please bare that in mind when
> berating me for my stupidity.

I have never found asking questions to be as stupid as not asking them.

> I'm having trouble with the following piece of code. This is just a
> stipped down example but persuaded me that the problem I'm getting lay
> within the pygres module. When this is run, it would appear the "now()"
> is evaluated at statement preparation or initial execution time. For
> each successive call to execute it would appear that now() is not
> re-evaluated and remains the same as the first time through the loop.

Not sure if this would be called a PyGreSQL issue or a PostgreSQL issue
but the system is acting correctly as far as it goes.  All you need to
do here is add "BEGIN WORK" and "END WORK" statements around the
query.  Otherwise every query is in the same transaction and the time
inside a transaction has to be consistent otherwise really strange
things can happen.

-- 
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org


More information about the PyGreSQL mailing list