Re: join from array or cursor

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: join from array or cursor
Date: 2009-08-21 17:13:17
Message-ID: 20090821171317.GG5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 21, 2009 at 12:05:51PM -0400, Tom Lane wrote:
> Sam Mason <sam(at)samason(dot)me(dot)uk> writes:
> > ... PG should instead arrange that the expression
> > "t" is run exactly once and reuse the single result for all columns.
>
> We might be able to do that based on the row-returning-subselect
> infrastructure being discussed over here:
> http://archives.postgresql.org/message-id/4087.1250867036@sss.pgh.pa.us

Huh, fun. Not sure if I'm interpreting this correctly, but what would
the difference in semantics between:

SELECT (SELECT 1,2);

and

SELECT (SELECT (1,2));

PG seems to make the distinction somewhat blurry at the moment. For
example, upthread I did:

SELECT (id((SELECT (1,2)::foo))).*;

and got back two columns, and yet when I do what I think is equivalent:

SELECT x.*
FROM (SELECT (1,2)::foo) x;

I get back my tuple, and not the values inside my tuple.

Should I be posting this to -hackers?

--
Sam http://samason.me.uk/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2009-08-21 17:58:34 Re: join from array or cursor
Previous Message David Fetter 2009-08-21 17:02:59 Re: New database or New Schema?