Parse Error when collation is defined without charset in column definition
Closed this issue · 1 comments
cenalulu commented
To reproduce use this table structure:
CREATE TABLE `foo` (
enroll_reason VARCHAR(1024) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci'
)
Exception:
osc.lib.sqlparse.create.ParseError: Line: enroll_reason VARCHAR(1024) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', Column: 55
Failed to parse SQL, unsupported syntax: Expected ")" (at char 75), (line:2, col:55)
cenalulu commented
If we remove the collate part, the parser can successfully parse it:
CREATE TABLE `foo` (
enroll_reason VARCHAR(1024) NULL DEFAULT NULL
)
NAME: foo
ENGINE: None
CHARSET: None
COLLATE: None
ROW_FORMAT: None
KEY_BLOCK_SIZE: None
COMPRESSION: None
AUTO_INCREMENT: None
COMMENT: None
PARTITION: None
[NAME: enroll_reason TYPE: VARCHAR DEFAULT: NULL LENGTH: 1024 CHARSET: None COLLATE: None NULLABLE: True UNSIGNED: None COMMENT: None]
PRIMARY_KEYS:
NAME: PRIMARY/ IS UNIQUE: True/ TYPE: None/ KEY LIST: / KEY_BLOCK_SIZE: None/ COMMENT: None
INDEXES:
Constraint:
After standardize
CREATE TABLE `foo` (
`enroll_reason` VARCHAR(1024) NULL DEFAULT NULL
)
Table checksum: 616c8cf9feb381dbe7edb0c51a4f82a9