Re: [HACKERS] gram.y

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] gram.y
Дата
Msg-id 366A2CDC.AB675F7D@alumni.caltech.edu
обсуждение исходный текст
Ответ на gram.y  (Sferacarta Software <sferac@bo.nettuno.it>)
Список pgsql-hackers
> I'm trying to make parser recognize SELECTs between parenthesis.
> I need to do this work to have m$access working with PostgreSQL.
> The micro$oft access jet (great wisdom) translates the UNIONs as:
> (SELECT ...) UNION (SELECT ...)

OK, just assume I have mentioned that you should ask M$ to support
standard syntax. It isn't entirely clear from the BNF definition of
SQL92 (parens near SELECT are allowed in some places), but I was hard
pressed to see where this was legal syntax.

> To have PostgreSQL understand this syntax I edited gram.y
> and I modified the "SelectStmt:" and the "SubUnion:" as:
> SelectStmt: opt_left_paren SELECT
<snip>

One problem with this is the parens must of course be balanced, so
making them individually optional is probably not the right thing to do.
Just to experiment I tried adding parens on some of the several places
where selects with unions are allowed, and started running into trouble
on the second one I tried. I'm guessing that a yacc-based parser will
run into serious trouble, but I haven't thought of a completely fatal
example yet.

Also, the way gram.y is currently laid out it would be difficult to
ensure that all clauses of the UNION are surrounded by parens if one
clause has those parens. But I think this would be desirable if the
parens are going to be allowed at all.
                     - Tom


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Parser bug (?)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Parser bug (?)