Re: Updatable views/with check option parsing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Updatable views/with check option parsing
Date: 2006-05-26 14:50:28
Message-ID: 25921.1148655028@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> I had a quick look - I don't think there is an easy answer with the
> current proposed grammar. If we want to prevent shift/reduce conflicts I
> suspect we'd need to use a different keyword than WITH, although I can't
> think of one that couldn't be a trailing clause on a select statment,
> which is the cause of the trouble. Another possibility would be to move
> the optional WITH clause so that it would come before the AS clause.

Unfortunately the SQL99 spec is perfectly clear about what it wants:

<view definition> ::=
CREATE [ RECURSIVE ] VIEW <table name>
<view specification>
AS <query expression>
[ WITH [ <levels clause> ] CHECK OPTION ]

<levels clause> ::=
CASCADED
| LOCAL

I haven't had time to play with this yet, but I suspect the answer will
have to be that we reinstate the token-merging UNION JOIN kluge that I
just took out :-(. Or we could look into recognizing the whole thing as
one token in scan.l, but I suspect that doesn't work unless we give up
the no-backtrack property of the lexer, which would be more of a speed
hit than the intermediate function was. Anyway it should certainly be
soluble with token merging, if we can't find a pure grammar solution.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-26 15:03:17 Re: max(*)
Previous Message Andrew Dunstan 2006-05-26 14:43:01 Re: Updatable views/with check option parsing