Skip to content

[BUG] JSQLParser 5.4-SNAPSHOT : MySQL : charset introducer (_utf8mb4) with COLLATE not supported #2427

@tomershay

Description

@tomershay

Failing SQL Feature

MySQL charset introducer _utf8mb4 used with COLLATE on string literals.

MySQL allows specifying a character set directly on string literals using introducers like _utf8mb4, _latin1, _binary. This can be combined with COLLATE to explicitly define collation for the literal.

SQL Example

DROP TABLE IF EXISTS custom_strings;
CREATE TABLE custom_strings (
    custom_string VARCHAR(255)
    CHARACTER SET utf8mb4
    COLLATE utf8mb4_unicode_ci
);

INSERT INTO custom_strings (custom_string) VALUES ('some text');

SELECT _utf8mb4'some text' COLLATE utf8mb4_unicode_ci AS custom_string;

Parsing Error

ParseException: Encountered: <K_COLLATE> / "COLLATE", at line 1, column 28, in lexical state DEFAULT.

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