Re: Understanding setof

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Robert James <srobertjames(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Understanding setof
Date: 2014-04-04 19:54:57
Message-ID: 533F0E11.9030204@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/04/2014 20:42, Robert James wrote:
> I'm having trouble with setof returning functions
>
> Let's say I have function x() returning setof integers. I want to do
> SELECT x(), but only keep the values which meet a criteria. Something
> like: SELECT x() as xval WHERE xval = 10.
>
> How can I do that?
>
> In general, is there a way to "unroll" a setof into a regular query?

if you mean that you want just a normal set of rows from the function, I
think you just do this:

select * from x() s(t) where t = 10;

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2014-04-04 19:55:53 Re: Understanding setof
Previous Message Torsten Förtsch 2014-04-04 19:54:51 Re: Indices and Foreign Tables