Class PLRuby::Description::Function::ExprMultiResult
In: plruby.rb
Parent: Object

Function returning SET (ExprMultiResult)

The return type must be declared as SETOF

The function is called until it returns nil

The method PL#context and PL#context= give the possibility to store information between the call

For example

   plruby_test=# create or replace function vv(int) returns setof int as '
   plruby_test'#    i = PL.context || 0
   plruby_test'#    if i >= args[0]
   plruby_test'#       nil
   plruby_test'#    else
   plruby_test'#       PL.context = i + 1
   plruby_test'#    end
   plruby_test'# ' language plruby;
   CREATE FUNCTION
   plruby_test=#
   plruby_test=# select * from uu;
    b
   ---
    2
   (1 row)

   plruby_test=#
   plruby_test=# select *,vv(3) from uu;
    b | vv
   ---+----
    2 |  1
    2 |  2
    2 |  3
   (3 rows)

   plruby_test=#

[Validate]