Bug with cursor declaration in plpgsql? (Repost)

Started by Michael Paesoldover 20 years ago2 messages
#1Michael Paesold
mpaesold@gmx.at

[Note: reposted because it didn't show up on the list after a day]

I have used to declare cursors in the DECLARE section of a PL/pgSQL
function. The example here seems to be broken in CVS tip:

CREATE FUNCTION test () RETURNS void AS '
DECLARE
credit_cursor CURSOR (p_account integer, p_reference integer) FOR
SELECT * FROM booking
WHERE account_id=p_account AND reference=p_reference
AND unassigned_amount = amount AND amount > 0 AND side=''credit''
AND position_closed AND type NOT IN (''RC'', ''RP'')
ORDER BY journal_id ASC;
BEGIN
END
'
LANGUAGE PLPGSQL;

I get:
ERROR: syntax error at or near "," at character 237
LINE 9: credit_cursor CURSOR (p_account integer, p_reference integ...

The same function works perfectly well in 7.4.8 and 8.0.3.
A bug?

Best Regards,
Michael Paesold

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paesold (#1)
Re: Bug with cursor declaration in plpgsql? (Repost)

"Michael Paesold" <mpaesold@gmx.at> writes:

I get:
ERROR: syntax error at or near "," at character 237
LINE 9: credit_cursor CURSOR (p_account integer, p_reference integ...

The same function works perfectly well in 7.4.8 and 8.0.3.
A bug?

Yeah, looks like Neil accidentally dropped the comma from
decl_cursor_arglist when he whacked that code around to use Lists
instead of handmade arrays. Thanks for catching it.

regards, tom lane