Re: join from array or cursor

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: John DeSoi <desoi(at)pgedit(dot)com>, Sam Mason <sam(at)samason(dot)me(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: join from array or cursor
Date: 2009-08-21 14:16:20
Message-ID: b42b73150908210716l51ad5605sab38776c66de8074@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 21, 2009 at 9:22 AM, Greg Stark<gsstark(at)mit(dot)edu> wrote:
> Of course immediately upon hitting send I did think of a way:
>
>  SELECT (r).*
>  FROM (SELECT (SELECT x FROM x WHERE a=id) AS r
>          FROM unnest(array[1,2]) AS arr(id)
>       ) AS subq;

nice use of composite type in select-list subquery. I use this
approach often...it's a 'wonder trick'.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-08-21 14:17:17 Re: join from array or cursor
Previous Message Tom Lane 2009-08-21 13:56:52 Re: "ownership" of sequences, pseudo random unique id