Skip to content

The Collate in types.FieldType in ColumnDef seems to be always empty #1309

@milkice233

Description

@milkice233

Feature Request

Is your feature request related to a problem? Please describe:
When using pingcap/parser to parse SQL statement, the Collate in types.FieldType in ColumnDef seems to be always empty even if with collate specified in SQL statement.

Consider the following SQL statement: CREATE TABLE contacts (col1 char(10) CHARACTER SET ascii COLLATE ascii_bin, col2 varbinary(7), col3 varchar(20));
After parsing, the collate in types.FieldType in ColumnDef seems to be always empty and collate option can only be found in Options Array.
image

Describe the feature you'd like:
If a COLLATE of a column is found then set the COLLATE type to the collate in types.FieldType.

Describe alternatives you've considered:
Users can always get the collate value in options array, but since there's a collate field in types.FieldType, I think the parser should take the responsibility of setting the collate option.

Teachability, Documentation, Adoption, Migration Strategy:
I've initiated a pull request #1310

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions