On 22 Nov 2013, at 21:56, Juan Daniel Santana Rodés 
<jdsant...@estudiantes.uci.cu> wrote:

> Hi everyone...
> I have a problem. I am programming a recursive function in plpgsql language. 
> This function use a cursor and when the function try to call the same 
> function throw a exception that it say me that the cursor is using.
> My friends how I can to resolve this problem.

Getting that error means that you are effectively trying to run multiple 
queries simultaneously in the same session. I don’t think that’s possible.

You didn’t tell what you’re trying to achieve, but it sounds to me that you 
either:
1. forgot to close the cursor for a short (non-recursive) lookup query before 
recursing to the same/next function,
2. or that you are actually trying to perform  a recursive query.

In case 1 the solution is simple; close the cursor before recursing.
For case 2, you may be able to rewrite your function to not recurse, but 
instead to use the results of a recursive CTE to achieve recursion.

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to