Skip to content

Fail to parse CHARACTER SET #296

@rubynle

Description

@rubynle

Describe the bug
when create table statement containts CHARACTER SET property,DDLParser(createsql).run() return empty list.

To Reproduce
Steps to reproduce the behavior:

python3 test code

from simple_ddl_parser import DDLParser

sql = '''
CREATE TABLE tab_space_station_common_info (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
col1 varchar(16) NULL DEFAULT NULL,
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4;
'''
print(len(DDLParser(sql).run()))

it will return 0, parse failed

sql1 = '''
CREATE TABLE tab_space_station_common_info (
id int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
col1 varchar(16) NULL DEFAULT NULL,
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB;
'''
print(len(DDLParser(sql1).run()))

it will return 1, parse sucess

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions