-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
executor: support prepare DDL statements with no parameters #10144
Conversation
Thank you @ian-p-cooke I can't figure out why we need to prepare DDL statements, could you explain your user case? |
@ngaut the case I ran into was using Diesel's "migrate" feature with the mysql driver against a TiDB instance. The driver assumes that all SQL statements that it sends can be prepared, including the DDL. This works fine for a mysql instance but a TiDB instance fails on the DDL. I talked to Diesel's maintainer and he suggested that TiDB would be better supported with a custom TiDB driver but I don't have time to work on that and the mysql driver works except for this DDL issue. Since this issue improves the compatibility with mysql I thought it would be a good change to TiDB. |
I think I messed up my pull request be rebasing on master manually. can this pull request be repaired or should I just start a new one? |
Codecov Report
@@ Coverage Diff @@
## master #10144 +/- ##
===============================================
+ Coverage 77.673% 77.6882% +0.0151%
===============================================
Files 411 411
Lines 85435 85408 -27
===============================================
- Hits 66360 66352 -8
+ Misses 14110 14097 -13
+ Partials 4965 4959 -6 |
@ian-p-cooke I think you can reset your branch and use force-push to update your repo. |
Thanks for detail explanation @ian-p-cooke |
ah, i used the 'update branch' button instead this time and now the pull request is back down to just my commits. I think you can squash them you pull, right? I won't do anything else with git right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@crazycs520 @bb7133 PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
This PR improves compatibility with MySQL 5.7 by accepting some DDL as prepared statements.
Currently TiDB accepts no DDL as prepared statements (#9425).
MySQL 5.7 lists some DDL statements in the accepted SQL for prepared statements: https://dev.mysql.com/doc/refman/5.7/en/sql-syntax-prepared-statements.html
What is changed and how it works?
I removed the explicit check for DDL and relaxed the restriction from no DDL to ddl without parameters. I don't believe parameters are used often for DDL and I am unable to test DDL with parameters so I left that restriction in. Even so it's still useful; for example, Diesel's MySQL driver prepares all statements, including DDL, and with this change TiDB becomes more compatible with MySQL 5.7 and Diesel.
Check List
Tests
Code changes
no function signatures have changed.
The text of ErrPrepareDDL changed.
Side effects
Related changes