Re: join from array or cursor - Mailing list pgsql-general

From Sam Mason
Subject Re: join from array or cursor
Date
Msg-id 20090821192425.GH5407@samason.me.uk
Whole thread Raw
In response to Re: join from array or cursor  (Merlin Moncure <mmoncure@gmail.com>)
List 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@samason.me.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/

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Comparing arrays of composite types
Next
From: David Kerr
Date:
Subject: Re: Schema diff tool?