From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) |
Date: | 2016-09-12 17:58:11 |
Message-ID: | 20160912175811.ids3nlrbgavkom3p@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2016-09-12 13:48:05 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2016-09-12 13:26:20 -0400, Tom Lane wrote:
> >> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2016-09-12 12:10:01 -0400, Tom Lane wrote:
> >>>> I can't say that I like the proposed syntax much.
>
> >>> Me neither. But I haven't really found a better approach. It seems
> >>> kinda consistent to have ROWS FROM (... AS ()) change the picked out
> >>> columns to 0, and just return the whole thing.
>
> >> I just remembered that we allow zero-column composite types, which
> >> makes this proposal formally ambiguous. So we really need a different
> >> syntax. I'm not especially in love with the cast-to-record idea, but
> >> it does dodge that problem.
>
> > I kind of like ROWS FROM (... AS VALUE), that seems to confer the
> > meaning quite well. As VALUE isn't a reserved keyword, that'd afaik only
> > really work inside ROWS FROM() where AS is required.
>
> Hm, wouldn't ... AS RECORD convey the meaning better?
I was kind of envisioning AS VALUE to work for composite types without
removing their original type (possibly even for TYPEFUNC_SCALAR
ones). That, for one, makes the SRF to ROWS FROM conversion easier, and
for another seems generally useful. composites keeping their type with
AS RECORD seems a bit confusing. There's also the issue that VALUE is
already a keyword, record not...
> (Although once you look at it that way, it's just a cast spelled in
> an idiosyncratic fashion.)
Well, not quite, by virtue of keeping the original type around. After a
record cast you likely couldn't directly access the columns anymore,
even if it were a known composite type, right?
Andres
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2016-09-12 18:04:06 | Re: ICU integration |
Previous Message | Tom Lane | 2016-09-12 17:48:05 | Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) |