Re: transaction problem using cursors

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Pit M(dot)" <fmi-soft(at)gmx(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: transaction problem using cursors
Date: 2007-06-11 13:40:58
Message-ID: 20070611134058.GC25296@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sean Davis 2007-06-11 13:54:13 Re: Distributing PostGres database to various customers
Previous Message Pit M. 2007-06-11 13:38:58 Re: transaction problem using cursors