Re: Gram.y patches for better parenthesis handling.
От | Tom Lane |
---|---|
Тема | Re: Gram.y patches for better parenthesis handling. |
Дата | |
Msg-id | 6784.972708940@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Gram.y patches for better parenthesis handling. ("Kevin O'Gorman" <kogorman@pacbell.net>) |
Список | pgsql-hackers |
"Kevin O'Gorman" <kogorman@pacbell.net> writes: > 2) It does NOT preserve the odd syntax I found when I started looking > at this, where a SELECT statement could begin with parentheses. Thus, > (SELECT a from foo) order by a; > fails. Um, as a general rule that's not an acceptable limitation. Consider (SELECT foo EXCEPT SELECT bar) INTERSECT SELECT baz; Without parens this will mean something quite different, since INTERSECT has higher precedence than EXCEPT. Also, a leading paren is clearly legal according to SQL92 --- trace for example the productions <direct select statement: multiple rows> <query expression> <non-join queryexpression> <non-join query term> <non-join query primary> ::= <left paren> <non-join queryexpression> <right paren> (UNION/EXCEPT structures are <non-join query expression> in this hierarchy.) The reason that making this grammar yacc-compatible is so hard is precisely that leading parens must sometimes be part of the SELECT structure, whereas extraneous parens need to be kept out of it. regards, tom lane
В списке pgsql-hackers по дате отправления: