calling a function that takes a row type and returns a set of rows

Поиск
Список
Период
Сортировка
От Robert Haas
Тема calling a function that takes a row type and returns a set of rows
Дата
Msg-id 603c8f070810101222h2745f90bg712d0745dd68c68f@mail.gmail.com
обсуждение исходный текст
Ответы Re: calling a function that takes a row type and returns a set of rows  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: calling a function that takes a row type and returns a set of rows  (Dimitri Fontaine <dfontaine@hi-media.com>)
Список pgsql-general
So, say I have something like this - the actual example is something a
bit more useful:

CREATE TABLE foo (a integer, b integer);
INSERT INTO foo VALUES (1, 1);   -- must have some data to generate the failure

CREATE FUNCTION bar (foo) RETURNS SETOF foo AS $$
DECLARE
    f foo;
BEGIN
    f.a := 1;
    RETURN NEXT f;
    f.a := 2;
    RETURN NEXT f;
END
$$ LANGUAGE plpgsql;

I can't find any legal way of calling this function.

SELECT bar(f) FROM foo f;
ERROR:  set-valued function called in context that cannot accept a set

SELECT * FROM foo f, bar(f);
ERROR:  function expression in FROM may not refer to other relations
of same query level

Any help appreciated.

Thanks,

...Robert

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

Предыдущее
От: "postgres Emanuel CALVO FRANCO"
Дата:
Сообщение: Re: Opteron vs. Xeon performance differences
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: calling a function that takes a row type and returns a set of rows