concatenating setof functions - Mailing list pgsql-general

From Frederick Ross
Subject concatenating setof functions
Date
Msg-id b91043270704161230u2e3aeee3q1519194220600f10@mail.gmail.com
Whole thread Raw
Responses Re: concatenating setof functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I suspect I am missing a much cleaner way of doing this, but say I
have a function which returns a setof integer, i.e.,

create or replace function testfunc (integer) returns setof integer as $$
declare
     i alias for $1;
begin
     return next i;
     return next i+100;
     return;
end
$$ language plpgsql;

I know I can call this as: select * from twohundreds(3);

But say I have a table with an integer column.  If I had a pure SQL
function, I could call

select twohundreds(i) from table;

and get a properly concatenated list of the rows resulting from
applying twohundreds to each row of table.  This is deprecated
according to the documentation, and it doesn't work at all with
PLPGSQL, so how should I go about doing it?

--
Frederick Ross
Graduate Fellow, (|Siggia> + |McKinney>)/sqrt(2) Lab
The Rockefeller University
Je ne suis pas Fred Cross!

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump seg fault on sequences
Next
From: Tom Lane
Date:
Subject: Re: concatenating setof functions