Re: PL/pgSQL: How to return two columns and multiple rows

Поиск
Список
Период
Сортировка
От Sven Geggus
Тема Re: PL/pgSQL: How to return two columns and multiple rows
Дата
Msg-id mlui5j$vns$2@solar.geggus.net
обсуждение исходный текст
Ответ на PL/pgSQL: How to return two columns and multiple rows  (Sven Geggus <lists@fuchsschwanzdomain.de>)
Список pgsql-general
Pavel Stehule <pavel.stehule@gmail.com> wrote:

> CREATE OR REPLACE FUNCTION public.fx(i integer, OUT a text, OUT b text)
>  RETURNS SETOF record
>  LANGUAGE plpgsql
> AS $function$
> BEGIN
>   RETURN QUERY SELECT 'foo'||id, 'bar'||id FROM generate_series(1,i) g(id);
>   RETURN;
> END;
> $function$

I'm afraid I will almost certainly be unable to use RETURN QUERY. I have
just broken this down to the posted code to make it easier to understand.

In my real world code a loop will need to iterate over features of a postgis
geometry returning a couple of rows containing a string and a calculated
geometry as a result.

Regards

Sven

--
"Thinking of using NT for your critical apps?
                                  Isn't there enough suffering in the world?"
                   (Advertisement of Sun Microsystems in Wall Street Journal)
/me is giggls@ircnet, http://sven.gegg.us/ on the Web

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: PL/pgSQL: How to return two columns and multiple rows
Следующее
От: Sven Geggus
Дата:
Сообщение: Re: PL/pgSQL: How to return two columns and multiple rows