An issue came up on irc. How come that this work:

  SELECT generate_series(0,1);

but

  SELECT foo(0,1);

does not, where foo is my own set returning function, like this example:

CREATE FUNCTION foo(a int, b int)
        RETURNS setof int
             AS 'BEGIN RETURN NEXT a;
                       RETURN NEXT b;
                       RETURN;
                 END' 
       LANGUAGE plpgsql;

As far as I can tell the generate_series() example is not supposed to 
work either.

Kris Jurka showed me another example that do work in the same way as 
generate_series:

CREATE FUNCTION bar(int, int)
        RETURNS setof int
             AS 'SELECT $1 UNION ALL SELECT $2;'
       LANGUAGE sql;

So it seems that it's not just the type that decide how the function can
be used, it's also the language the function is defined in.

Bug?

-- 
/Dennis Björklund


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to