"RETURNS SETOF" function question

Поиск
Список
Период
Сортировка
От Kynn Jones
Тема "RETURNS SETOF" function question
Дата
Msg-id c2350ba40802241419qeaec89k82e1c020f90b819f@mail.gmail.com
обсуждение исходный текст
Ответы Re: "RETURNS SETOF" function question
Список pgsql-general

Suppose that stored procedure foo has the signature:

  foo( text, text ) RETURNS SETOF text

Also, I have some table bar, and that column bar.baz is of type text.

Now, I'd like to run something like

  SELECT foo( "frobozz", baz ) FROM bar;

If I try this psql complains that I'm trying to execute a set-valued function in the wrong context.

But the intention of this invalid statement is to apply foo( "frobozz", ? ) once for each row of bar, replacing ? each time with the row's value of baz, and concatenate all the returned tables to produce the final result.  (In general, the number of rows resulting from this application has no relation to the number of rows in bar; i.e. it can be less than, equal to, or greater than this number.)

What must I do to get the desired behavior?

TIA!

kynn

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

Предыдущее
От: "hernan gonzalez"
Дата:
Сообщение: Re: text and bytea
Следующее
От: "Joris Dobbelsteen"
Дата:
Сообщение: More formal definition of functions in documentation