Re: cursor already in use error

From: "Sim Zacks" <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: cursor already in use error
Date: 2005-03-02 10:02:28
Message-ID: d04330$31he$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2005-03-02 10:03:16 Re: cursor already in use error
Previous Message Alban Hertroys 2005-03-02 09:55:59 Re: cursor already in use error