Skip to content

Error in parsing create statement: Encountered unexpected token: "KEY" "KEY" #1589

Open
@Vipin-Sharma

Description

@Vipin-Sharma

This is one of the tables from the famous sakila DB, I am using SQL Server.

CREATE TABLE actor (
  actor_id INT NOT NULL IDENTITY ,
  first_name VARCHAR(45) NOT NULL,
  last_name VARCHAR(45) NOT NULL,
  last_update DATETIME NOT NULL,
  PRIMARY KEY NONCLUSTERED (actor_id)
  );

These are 2 ways I tried to parse this statement and got error in both cases:

CCJSqlParserUtil.parse(ddlString, parser -> parser.withSquareBracketQuotation(true));
CCJSqlParserUtil.parse(ddlString);

Error:

Encountered unexpected token: "KEY" "KEY"
    at line 1, column 164.

Was expecting one of:

    "BINARY"
    "BIT"
    "CHAR"
    "CHARACTER"
    "DOUBLE"
    "INTERVAL"
    "JSON"
    "SET"
    "SIGNED"
    "UNSIGNED"
    "XML"
    <DT_ZONE>
    <K_DATETIMELITERAL>
    <K_DATE_LITERAL>
    <S_IDENTIFIER>
    <S_QUOTED_IDENTIFIER>

is there any workaround available for this, other than modifying the DDL?

I am using JDK18 and jsqlparser version is 4.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DDLDDL statement related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions