From: | Alban Hertroys <haramrae(at)gmail(dot)com> |
---|---|
To: | Juan Daniel Santana Rodés <jdsantana(at)estudiantes(dot)uci(dot)cu> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Recursive function |
Date: | 2013-11-23 10:48:36 |
Message-ID: | 2E5562ED-4B1C-402E-AAAF-32D0BD69025C@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 22 Nov 2013, at 21:56, Juan Daniel Santana Rodés <jdsantana(at)estudiantes(dot)uci(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jayadevan M | 2013-11-23 12:16:28 | WITH and exclusive locks |
Previous Message | Ken Tanzer | 2013-11-23 10:45:07 | Re: Getting non_NULL right-side values on a non-matching join? |