JSQLParser / JSqlParser

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern
https://github.com/JSQLParser/JSqlParser/wiki
Apache License 2.0
5.32k stars 1.34k forks source link

[BUG] JSQLParser Version 5.0 : RDBMS : failing parsing empty statements with ; #2063

Closed d2a-raudenaerde closed 4 weeks ago

d2a-raudenaerde commented 1 month ago

Failing SQL Feature:

SQL Example:

Software Information:

This works fine in Postgres

manticore-projects commented 4 weeks ago

Greetings!

this is a known issue which does not have a good solution because: What statement would you want the parser to return here? Instead, apply a SQL Comment filter (e.g. using a regex) and check remaining length before sending to the parser.

d2a-raudenaerde commented 3 weeks ago

Well, I expect an empty list as I am parsing multiple statements :)

(alternatively, EmptyStatement would be ok-isch)

manticore-projects commented 3 weeks ago

Well, I expect an empty list as I am parsing multiple statements :)

(alternatively, EmptyStatement would be ok-isch)

I get your point and before actually working on the parser I would have done the same. However, the Parser Generator is not easily supporting this because there is only "IF MATCH" but no "ELSE".

If you can make it work, your PR will be most welcome. I myself find it easier to mangle the the statements before with Regular expressions.