BUG #2963: PQprepare and transactions.

From: "DUVAL Jean-Pierre" <jp(dot)duval(at)up-comp(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2963: PQprepare and transactions.
Date: 2007-02-03 17:11:57
Message-ID: 200702031711.l13HBvGa011565@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2963
Logged by: DUVAL Jean-Pierre
Email address: jp(dot)duval(at)up-comp(dot)com
PostgreSQL version: 8.1.3
Operating system: Windows XP
Description: PQprepare and transactions.
Details:

To speed up programs, I call:
1) PQprepare("MyStatement") one time.
2) PQexecPrepared("MyStatement") many times.
3) PQexec("DEALLOCATE MyStatement") to deallocate the statement prepared.

This works with no transaction.

Case A :
--------
If I put all these three steps in a loop finished by a commit or rollback, I
cann't neither do again:
A) PQprepare("MyStatement") one time.
B) PQexecPrepared("MyStatement") many times.

Case B :
--------
Moreover, just after connecting, if I just do a rollback and then a begin
transaction, I cann't neither do at second iteration:
A) PQprepare("MyStatement") one time.
B) PQexecPrepared("MyStatement") many times.

It seems that PQprepare() is using something like DECLARE CURSOR WITHOUT
HOLD, that is impacted by transactions:
X) Either destroyed at the end of the transaction.
Y) Or not possible to do when a transaction is open.

It should be better to use WITH HOLD inside PQprepare() or to add a
parameter to do so. In this case the behavior of PostgreSQL to manage
prepared statements and transactions should be like the one of other
database engines - Db2, Informix, Oracle, Max DB, My Sql, Sql Server for
which I am sure of the behavior.

At this time, due to this bug, it is not possible to write a large batch
program handling millions of datas.

Jean-Pierre DUVAL - jp(dot)duva(at)up-comp(dot)com - www.up-comp.com

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2007-02-03 23:56:00 Re: "Julian day" date format is off by 12 hours
Previous Message Gary Chambers 2007-02-02 22:54:26 BUG #2962: 8.2.1 lo_creat Documentation incorrect?