Re: OS-SQL-Grammar?

From: Dieter Nöth <dnoeth_at_gmx.de>
Date: Thu, 07 Jul 2011 10:04:21 +0200
Message-ID: <iv3pa5$gol$1_at_news.albasani.net>


Norbert_Paul wrote:

> is there a handy (and parseable) Open Source SQL-grammar around,
> that can be fed into a parser generator without major problems?

Did you try the BNF grammar files at
http://savage.net.au/SQL/index.html

If you happen to succeed could you please post a "how-to"? I was looking for the same stuff some years ago (to implement a source code beautifier) and i failed.

> I consider ISO 9075:2003 useless for this purpose and don't get
> the point of this "standard".

They just have the wording of a law code and you must be a lawyer (or similar) to actually read (and understand) more than just a few paragraphs ;-)

> Is the following string
>
> "/* this is */ a strange comment */"
>
> a valid SQL-Comment (according to SQL 2003)?

No.
If you don't remove the double quotes it's an (very strange) identifier and if you remove them it should result in a syntax error because the comment ends after the first "*/".

The standard defines nested comments, but not all DBMSes support them: "/* this is a /* nested */ comment */"

You probably wouldn't consider this as a valid string: 'bla' blabla'

Dieter Received on Thu Jul 07 2011 - 10:04:21 CEST

Original text of this message