create function func_test_ref_cursor(refcursor) returns refcursor as $$ begin open $1 for select * from test limit 100; return $1; end $$language plpgsql;
begin; select func_test_ref_cursor('test_cursor'); fetch all from test_cursor; rollback;