JSqlParser
JSqlParser copied to clipboard
Error in parsing create statement: Encountered unexpected token: "KEY" "KEY"
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.
JSqlParser does not support the option nonclustered for primary keys. PRs are wellcome.
@wumpz I am using this for another open source project I am developing now a days, for now I am afraid will not be able to spend time in this but being supporters of open source projects I know couple of folks who may want to do this. It will help new contributors if you can provide some guidance what all places changes might be required or some thoughts on design how you want it to be implemented or some design document that can help understanding architecture of components used in JSQLParser.
Coming back to the issue, is there any list available what all features are not supported in ddl? I am using JSQLParser to read ddls and I would like to publish not supported options.
@Vipin-Sharma : Checkout the unoffical documentation of the supported grammar at http://217.160.215.75:8080/jsqlformatter/syntax.html
@Vipin-Sharma : Checkout the unoffical documentation of the supported grammar at http://217.160.215.75:8080/jsqlformatter/syntax.html
@manticore-projects this is helpful to understand what is supported right now. If code generated this is open source I would like to see that, that can help me to understand JSQLParser more.
For the samples provided on link you suggested, is there any way we can create database to try out these samples?