From: | Greg Stark <stark(at)mit(dot)edu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Review: UNNEST (and other functions) WITH ORDINALITY |
Date: | 2013-07-28 18:06:57 |
Message-ID: | CAM-w4HM=yMNQ0Meo_1LxQZwV7DSNqFAnE3nxw2B9AekYq9H-Rw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 24, 2013 at 7:00 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I don't see any workable fix that doesn't involve the funny token, though.
> Consider
>
> CREATE VIEW v AS SELECT ... FROM UNNEST(...) WITH ORDINALITY;
> CREATE VIEW v AS SELECT ... FROM UNNEST(...) WITH NO DATA;
>
> WITH ORDINALITY really needs to be parsed as part of the FROM clause.
> WITH NO DATA really needs to *not* be parsed as part of the FROM clause.
> Without looking ahead more than one token, there is absolutely no way
> for the grammar to decide if it's got the whole FROM clause or not
> at the point where WITH is the next token. So our choices are to have
> two-token lookahead at the lexer level, or to give up on bison and find
> something that can implement a parsing algorithm better than LALR(1).
> I know which one seems more likely to get done in the foreseeable future.
It occurs to me we might be being silly here.
Instead of collapsing WITH TIME and WITH ORDINALITY into a single
token why don't we just modify the WITH token to WITH_FOLLOWED_BY_TIME
and WITH_FOLLOWED_BY_ORDINALITY but still keep the following token.
Then we can just include those two tokens everywhere we include WITH.
Basically we would be giving the parser a free extra token of
lookahead whenever it gets WITH.
I think that's isomorphic to what Tom suggested but requires less
surgery on the parser and automatically covers any other cases we
don't need to track down.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-07-28 18:43:50 | Re: Review: UNNEST (and other functions) WITH ORDINALITY |
Previous Message | Marko Tiikkaja | 2013-07-28 18:06:04 | Re: replication_reserved_connections |