-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Resolve parsing error for CHARACTER SET and COLLATE in MySQL ALTER TABLE (issue 2027) #2045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fixes #2027 |
Hi, @manticore-projects |
Greetings! Likely because the GitHub build environment is slower (cpu clock/speed wise) than your local environment -- meaning that your change still slows the parser down, which is not a welcome development. |
@manticore-projects |
Any change in the Grammar can have potentially big impact. I would still merge it (and fix this performance exception manually by adding timeout). However, please address my concern on the |
@manticore-projects |
Something is wrong. In the Github Maven task I see:
However, when pulling your PR and compile locally everything seems to work. This confuses the hell out me right now. |
I have merged it and will test/fix whatever problem directly. |
Your changes cause real breakage: case K_TEXT_LITERAL:{
tk = jj_consume_token(K_TEXT_LITERAL);
type = tk.image;
return new ColDataType(type, precision, scale);
break;
} Although I don't understand why |
@manticore-projects |
No problem at all, that's what team work is for. Thank you again for your help and contribution! |
Problem
When attempting to parse
ALTER TABLE
statements in MySQL that includeCHARACTER SET
andCOLLATE
specifications for column types such astext
,tinytext
,mediumtext
, andlongtext
, aParseException
is thrown. This issue is currently present in JSqlParser version 5.0.#2027
Solution
This PR introduces updates to the parsing rules within JSqlParser, allowing for correct handling of
CHARACTER SET
andCOLLATE
clauses in MySQLALTER TABLE
statements. The changes involve modifying the token recognition patterns and parser rules to ensure that these keywords are properly interpreted when following the mentioned text data types.Tests
The following test cases have been added to verify the correct parsing of modified statements:
ALTER TABLE
withtext
ALTER TABLE
withtext
, includingCHARACTER SET
andCOLLATE
tinytext
,mediumtext
, andlongtext
.These tests ensure that the parser remains stable and performs as expected across these common use cases in MySQL.
I look forward to feedback and further suggestions!