On Wed, Mar 02, 2005 at 11:15:52AM +0200, Sim Zacks wrote:
> select name,testcursor(testid) from test; --doesn't work
> select name,testcursor(testid) from test where testid=1; -- works (as does
> testid=2 or 3)
If I add "close crs;" before the function returns, I get this:
SELECT name, testcurs
> Always close your cursors.
>
Thanks.
In my real example I had multiple return points and did not close the cursor
before each one.
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
joining c
> 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 th
Sim Zacks wrote:
create or replace function testcursor(thistestid int) returns varchar as
$$
declare
crs Cursor for select comments from test a join test2 b on
a.testid=b.testid where a.TestID=thistestid;
thiscomment varchar;
totalstr varchar;
begin
open crs;
fetch crs into thiscomment;
total
I haven't tried 8.0.1 yet. I am planning on making the upgrade soon, but
since I haven't seen this issue discussed I did not think it had been fixed
just because I am using an older version. I did search the Internet and
found one person who had the same issue and found a workaround that won't
appl
On Wed, Mar 02, 2005 at 09:21:44AM +0200, Sim Zacks wrote:
> PostGreSQL 8.0beta1
That's pretty old. Have you tried 8.0.1?
> I have a function that uses a cursor and it is giving me the error: cursor
> "crsr" already in use when the parameters I pass in come from another table.
>
> The function
PostGreSQL 8.0beta1
I have a function that uses a cursor and it is giving me the error: cursor
"crsr" already in use when the parameters I pass in come from another table.
The function works fine when I call it by itself, such as select
PartNeedsReschedule(100,1) or select * from PartNeedsReschedu