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

From Pavel Stehule
Subject Re: transaction problem using cursors
Date
Msg-id 162867790706110616s73add729tac399834c41e9c1d@mail.gmail.com
Whole thread Raw
In response to Re: transaction problem using cursors  (Thomas Pundt <mlists@rp-online.de>)
Responses Re: transaction problem using cursors  ("Pit M." <fmi-soft@gmx.de>)
List pgsql-general
>
> I didn't try myself, but wrapping the whole into a PL/pgSQL function and
> using exceptions might do the work;
>
>

It's not good advice. I tested it, and problem is in where clause. I
don't understand problem well, but one possibility is change from cast
to to_number function like:

postgres=# begin;
BEGIN
postgres=# declare c cursor for select * from fx where to_number(b,'99999') > 0;
DECLARE CURSOR
postgres=# fetch from c;
 a  | b
----+----
 10 | 20
(1 row)

postgres=# fetch from c;
 a  |  b
----+-----
 10 | a20
(1 row)

But still this solution is +/- correct

Regards
Pavel

pgsql-general by date:

Previous
From: "Pit M."
Date:
Subject: Re: transaction problem using cursors
Next
From: "Pavel Stehule"
Date:
Subject: Re: Functions that return both Output Parameters and recordsets