AI disclosure: this issue was prepared with AI coding agents, reviewed and revised line by line by me.
Failing SQL Feature:
MySQL # line comments are not parsed. MySQL supports # to end of line as a comment style (MySQL 8.0 Manual, Comments). JSqlParser handles -- and /* */, but # fails.
Context: # is currently lexed for the PostgreSQL JSON operators #> and #>> (JSqlParserCC.jjt, token handling around line 8403). A line comment rule must not swallow those: with javacc longest-match, a plain # to end of line token would also consume #> / #>>, so the comment rule needs to exclude a > immediately after #.
SQL Example:
net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered: <K_COMMENT> / "comment", at line 1, column 12, in lexical state DEFAULT.
A standalone comment line fails the same way:
SELECT 1
# trailing comment
net.sf.jsqlparser.parser.ParseException: Encountered: <K_TRAILING> / "trailing", at line 2, column 3, in lexical state DEFAULT.
SELECT 1 -- comment parses fine.
Software Information:
- JSqlParser version: master
1e4e92b (also present in 5.1)
- Database: MySQL 8.0
AI disclosure: this issue was prepared with AI coding agents, reviewed and revised line by line by me.
Failing SQL Feature:
MySQL
#line comments are not parsed. MySQL supports#to end of line as a comment style (MySQL 8.0 Manual, Comments). JSqlParser handles--and/* */, but#fails.Context:
#is currently lexed for the PostgreSQL JSON operators#>and#>>(JSqlParserCC.jjt, token handling around line 8403). A line comment rule must not swallow those: with javacc longest-match, a plain#to end of line token would also consume#>/#>>, so the comment rule needs to exclude a>immediately after#.SQL Example:
A standalone comment line fails the same way:
SELECT 1 -- commentparses fine.Software Information:
1e4e92b(also present in 5.1)