mysql sql('CREATE DATABASE IF NOT EXISTS xxx CHARACTER SET "utf8mb4" COLLATE "utf8mb4_bin" COMMENT "xxx";') but parse,lint can't understand right and give error thart Found unparsable section: 'CHARACTER SET
qiusheng2011 opened this issue · comments
Search before asking
- I searched the issues and found no similar issues.
What Happened
mysql sql('CREATE DATABASE IF NOT EXISTS xxx CHARACTER SET "utf8mb4" COLLATE "utf8mb4_bin" COMMENT "xxx";') but parse,lint can't understand right and give error thart Found unparsable section: 'CHARACTER SET
Expected Behaviour
mysql sql('CREATE DATABASE IF NOT EXISTS xxx CHARACTER SET "utf8mb4" COLLATE "utf8mb4_bin" COMMENT "xxx";')
is ok
Observed Behaviour
Found unparsable section: 'CHARACTER SET
How to reproduce
mysql sql('CREATE DATABASE IF NOT EXISTS xxx CHARACTER SET "utf8mb4" COLLATE "utf8mb4_bin" COMMENT "xxx";') but parse,lint can't understand right and give error thart Found unparsable section: 'CHARACTER SET
Dialect
mysql
Version
sqlfluff version 3.0.3
Configuration
no
Are you willing to work on and submit a PR to address the issue?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
According to the docs, mysql doesn't support comments on databases. Can you confirm this is mysql, or are you using something else, like mariadb?
The problem is on the character set section, @WittierDinosaur.
I can reproduce the issue with this snippet:
CREATE TABLE Plan ( Id INT UNSIGNED AUTO_INCREMENT NOT NULL,
Name VARCHAR(100) NOT NULL,
PRIMARY KEY(Id)
) DEFAULT CHARACTER SET `utf8mb4` COLLATE `utf8mb4_general_ci`;
- The dialect I have set is mysql.
- Without the backticks it also fails.