Skip to content

Failed to parse when creating unique index in creation DDL #823

Open
@RewardisGem

Description

@RewardisGem

Actual Behavior

Parsing creation DDL like:

CREATE TABLE test3 (
NAME varchar(255) NOT NULL DEFAULT '',
ID bigint(20) unsigned NOT NULL,
PRIMARY KEY (NAME), unique index idx(id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Throw exception
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "unique" "UNIQUE"
at line 4, column 25.

The DDL works fine in MySQL 5.7. I change
unique index idx(id) ---> unique key idx(id) then jsqlparser works.

Specifications

  • Version: jsqlparser V2.1
  • Platform: Macos 10.14.5 Java 8
  • Subsystem:

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions