"Henry Combrinck" <henry(at)zen(dot)co(dot)za> writes:
> Anyone know the most efficient way of FETCHing a batch of rows, and
> looping through them in a function? FETCHing a record at a time will
> work, but I was wondering whether this could be done.
You're outsmarting yourself. plpgsql already does the equivalent of
this under the hood, there is no need for you to try to make it happen
at user level. Just use a plain ol' FOR rec IN SELECT and forget the
explicit cursor.
regards, tom lane