Skip to content

[BUG] JSQLParser Version : RDBMS: Empty lines causes exception #2352

@perNyfelt

Description

@perNyfelt

Failing SQL Feature:

Several successive, empty lines causes the query to fail parsing.

SQL Example:

  • Simplified Query Example, focusing on the failing feature
      WITH LatestSalary AS (
          SELECT
            employee,
            salary,
    
    
    
    
            ROW_NUMBER() OVER (
              PARTITION BY employee
              ORDER BY change_date DESC, id DESC
            ) as rn
          FROM
            salary
        )
        SELECT e.*, ls.salary
        FROM employees e
        JOIN LatestSalary ls ON e.id = ls.employee
        WHERE ls.rn = 1;

Software Information:

  • JSqlParser version 5.3
  • Database any

Error details:

net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 4, column 11.

Was expecting:

")"


at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:352)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:125)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:91)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:64)
at jsqlparser.ParsingTest.testParseStatementIssue2352WithoutComment(ParsingTest.java:46)

Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
at line 4, column 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions