Skip to content

MySQL parse failure with query hints #1325

Closed
@priyankvashist

Description

@priyankvashist

I am getting error while parsing the MySQL with query hints:

SQL: SELECT col FROM table USE INDEX(primary)

Error while parsing:
`Exception in thread "main" net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "primary" "PRIMARY"
at line 1, column 33.

Was expecting one of:

<S_IDENTIFIER>
<S_QUOTED_IDENTIFIER>

at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseAST(CCJSqlParserUtil.java:84)
at ParserDemo.main(ParserDemo.java:75)

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "primary" "PRIMARY"
at line 1, column 33.`

Changing primary to another string like primary1 works.

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