Re: SETOF - Mailing list pgsql-sql

From Greg Stark
Subject Re: SETOF
Date
Msg-id 87u1ei7x5u.fsf@stark.dyndns.tv
Whole thread Raw
In response to Re: SETOF  (Christoph Haller <ch@rodos.fzk.de>)
List pgsql-sql
Christoph Haller <ch@rodos.fzk.de> writes:

> >
> >
> > Christoph Haller <ch@rodos.fzk.de> writes:
> >
> > > You cannot obtain several columns from SQL functions.
> > > See the list archives (search for SETOF) for details.
> > > You have to use e.g. a plpgsql function instead.
> >
> > How do you do it with a plpgsql function?
>
> And Greg, refer to
> http://techdocs.postgresql.org/guides/SetReturningFunctions
> 
> I think it will fit your needs.

That document describes using the function in the from list of the select.
That's equivalent to converting the query to a join, which isn't always
possible or convenient. I was talking about using a subquery or function in
the output column list to produce multiple output columns.

I'm sorry I may have muddied the waters in that it sounds like my comment
wasn't about exactly the same issue as Chistoph's. 

-- 
greg



pgsql-sql by date:

Previous
From: Christoph Haller
Date:
Subject: Re: LIMIT and SUBQUERIES
Next
From: Greg Stark
Date:
Subject: Re: SETOF