Re: Updatable views/with check option parsing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Updatable views/with check option parsing
Date
Msg-id 25921.1148655028@sss.pgh.pa.us
Whole thread Raw
In response to Re: Updatable views/with check option parsing  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Updatable views/with check option parsing
Next
From: Tom Lane
Date:
Subject: Re: max(*)