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 19:24:25
Message-ID: 20090821192425.GH5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 21, 2009 at 01:58:34PM -0400, Merlin Moncure wrote:
> On Fri, Aug 21, 2009 at 1:13 PM, Sam Mason<sam(at)samason(dot)me(dot)uk> wrote:
> > On Fri, Aug 21, 2009 at 12:05:51PM -0400, Tom Lane wrote:
> >> 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
> >
> > 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));
>
> The first form is not allowed because subqueries used that way must
> return only one column. The second form works because the extra
> parens constructs a row type which gets around that restriction.

I was under the impression that the message Tom was pointing to was
about lifting this restriction. I believe the use case was of being
able to do:

UPDATE foo SET (a,b,c) = (SELECT 1,2,3);

if I'm reading things correctly. I was expecting this to be generally
available where any sub-select was supported and hence I was wondering
what its semantics would be. It seemed like an interesting corner case
and I'd not seen it discussed in the linked threads.

If I'm not reading things correctly then the rest is a mute point.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Kerr 2009-08-21 19:29:55 Re: Schema diff tool?
Previous Message Merlin Moncure 2009-08-21 19:23:21 Re: Comparing arrays of composite types