Re: transaction problem using cursors - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: transaction problem using cursors
Date
Msg-id 20070611134058.GC25296@svana.org
Whole thread Raw
In response to Re: transaction problem using cursors  ("Pit M." <fmi-soft@gmx.de>)
Responses Re: transaction problem using cursors  ("Pit M." <fmi-soft@gmx.de>)
List pgsql-general
On Mon, Jun 11, 2007 at 03:28:22PM +0200, Pit M. wrote:
> We handle exceptions errors through libpq, and if a FETCH leads to such
> a runtime error, we try to FETCH the first record again.
> The problem is that we can't use this cursor any more -> it seems to be
> corrupt after that error.

An aborted transaction is an aborted transaction, you have to rollback
to a known state before you can go on.

I'm not sure why you can't just change the queries, but in the
particluar case you give, why not just treat them as strings to start
with:

   WHERE "CUSTOMERS"."ZIP" >= '10000'
                    AND "CUSTOMERS"."ZIP" < '20000'

That will produce the same result, but without any chance of errors...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: "Pit M."
Date:
Subject: Re: transaction problem using cursors
Next
From: Sean Davis
Date:
Subject: Re: Distributing PostGres database to various customers