apache / apache/datafusion-sqlparser-rs

Failed to parse Mysql CHARACTER SET with COLLATE clause

Open
#1,544 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

When using SQLParser, the following ALTER TABLE statement fails to parse:
ALTER TABLE `test`.`test` MODIFY COLUMN `v` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AFTER `id`,DROP PRIMARY KEY,ADD PRIMARY KEY (`id`, `v`) USING BTREE
The issue seems to be related to the presence of the COLLATE latin1_swedish_ci clause. If the COLLATE clause is removed, the statement parses successfully.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported ALTER TABLE statement with SQLParser, comparing it with the version that omits the COLLATE clause. The work is done when the full MySQL statement, including CHARACTER SET and COLLATE, parses successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.