I am trying to use a cursor returned from a function to manipulate some tables in database.
But I am trying out this small example to give me an idea of how to go about it.


CREATE TABLE test (col text);
INSERT INTO test VALUES ('123');

CREATE FUNCTION reffunc(refcursor) RETURNS refcursor AS '
BEGIN
OPEN $1 FOR SELECT col FROM test;
RETURN $1;
END;
' LANGUAGE 'plpgsql';

BEGIN ;
SELECT reffunc('funccursor');
FETCH ALL IN funccursor;
COMMIT;
end;

The problem is that I get these messages
1. Error: fmgr_info : function 0: cache lookup failed
2.notice: current transaction is aborted , queries ignored until end of transcation block.

I will be greatful for you help.
Thanks