Skip to content

CCJSqlParserUtil fails on different variable names #1462

Closed
@DiegoKrupitza

Description

@DiegoKrupitza

Describe the bug
When I want to parse the following query

select p from Customer c join c.productOrder p where p.delayed = true

using (Select) CCJSqlParserUtil.parse(query); I get the following error:

net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "." "."
    at line 1, column 55.

Was expecting one of:

    "&"
    "::"
    ";"
    "<<"
    ">>"
    "COLLATE"
    "CONNECT"
    "EMIT"
    "GROUP"
    "HAVING"
    "START"
    "["
    "^"
    "|"
    <EOF>

	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:190)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:63)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:38)
	at org.springframework.data.jpa.repository.query.JSqlParserQueryUtils.parseSelectStatement(JSqlParserQueryUtils.java:111)
	... 71 more

Although when I try to parse the following query

select p from Customer c join c.productOrder p where p.delaye = true

everything works as expected.

It is quite stragne that only the difference between delayed and delaye makes the parsing to fail. Maybe I am getting something wrong but I think an identifier should not make such a huge difference.

To Reproduce
See above

Expected behavior
Both queries should be parse without failing.

System

  • Database you are using: No DB just calling CCJSqlParserUtil.parse(query)
  • Java Version: Azul Zulu 1.8.0_322
  • JSqlParser version: 4.3.0

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