Re: UNNEST with multiple args, and TABLE with multiple funcs

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, David Johnston <polobo(at)yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: UNNEST with multiple args, and TABLE with multiple funcs
Date: 2013-12-03 04:26:49
Message-ID: 20131203042649.GA1163520@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 02, 2013 at 08:56:03PM -0500, Tom Lane wrote:
> Noah Misch <noah(at)leadboat(dot)com> writes:
> > ... I propose merely changing the syntax to "TABLE FOR ROWS (...)".
>
> Ugh :-(. Verbose and not exactly intuitive, I think. I don't like
> any of the other options you listed much better. Still, the idea of
> using more than one word might get us out of the bind that a single
> word would have to be a fully reserved one.
>
> > ROWS FROM
>
> This one's a little less awful than the rest. What about "ROWS OF"?

I had considered ROWS OF and liked it, but I omitted it from the list on
account of the shift/reduce conflict from a naturally-written Bison rule.
Distinguishing it from a list of column aliases takes extra look-ahead. We
could force that to work. However, if we ever wish to allow an arbitrary
from_item in the list, it would become ambiguous: is this drawing rows from
"a" or just using an alias with a column list?

WITH a AS (SELECT oid FROM pg_am ORDER BY 1) SELECT * FROM rows of(a, a);

ROWS FOR is terse and conflict-free. "FOR" evokes the resemblance to looping
over the parenthesized section with the functions acting as generators.

--
Noah Misch
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-12-03 05:47:07 Re: pgsql: Fix a couple of bugs in MultiXactId freezing
Previous Message David Fetter 2013-12-03 04:26:34 Re: Status of FDW pushdowns