Re: cursor already in use error - Mailing list pgsql-general

From Sim Zacks
Subject Re: cursor already in use error
Date
Msg-id d04330$31he$1@news.hub.org
Whole thread Raw
In response to cursor already in use error  ("Sim Zacks" <sim@compulab.co.il>)
List pgsql-general
> If I add "close crs;" before the function returns, I get this:
>
> SELECT name, testcursor(testid) FROM test;
>  name |           testcursor
> ------+--------------------------------
>  Bob  | -Comment 1-Comment 2-Comment 3
>  Mark | -Comment 1
>  Tom  |
> (3 rows)
>

You got it.
I was closing the cursor at the end of the function, but there were other
possible returns in the middle.
I changed the code to add close before each return and it works like a
charm.

I rushed together the example, or I should have caught that.

Much thanks.
Sim




pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: cursor already in use error
Next
From: "Sim Zacks"
Date:
Subject: Re: cursor already in use error