set returning function

Поиск
Список
Период
Сортировка
От Dennis Bjorklund
Тема set returning function
Дата
Msg-id Pine.LNX.4.44.0505091208380.7072-100000@zigo.dhs.org
обсуждение исходный текст
Ответы Re: set returning function  (Kris Jurka <books@ejurka.com>)
Re: set returning function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: BUG #1654: can't run SQL commands
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: set returning function