Re: PL/pgSQL: How to return two columns and multiple rows - Mailing list pgsql-general

From Sven Geggus
Subject Re: PL/pgSQL: How to return two columns and multiple rows
Date
Msg-id mlui5j$vns$2@solar.geggus.net
Whole thread Raw
In response to PL/pgSQL: How to return two columns and multiple rows  (Sven Geggus <lists@fuchsschwanzdomain.de>)
List 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 by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: PL/pgSQL: How to return two columns and multiple rows
Next
From: Sven Geggus
Date:
Subject: Re: PL/pgSQL: How to return two columns and multiple rows