Skip to content

[BUG] 5.0 : MySQL : Parsing ALTER TABLE statement with CHARACTER SET fails #2027

Closed
@jakobmerrild

Description

@jakobmerrild

Failing SQL Feature:

Trying to parse an ALTER TABLE statement for MySQL fails when the column definition contains the CHARACTER SET keywords.
Encountering the following error

ParseException: Encountered unexpected token: "SET" "SET"
    at line 2, column 55.

Was expecting one of:

    ","
    <EOF>
    <ST_SEMICOLON>

SQL Example:

ALTER TABLE `foo_bar`
    ADD COLUMN `baz` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
    ALGORITHM = INSTANT;

Software Information:

  • JSqlParser version: 5.0
  • Database MySQL
  • Writing in Scala, though that shouldn't affect anything 🤞

Additional information

The failing code is

CCJSqlParserUtil.parseStatements(fileContent)

where fileContent is a String containing the entire content of the SQL file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions