-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
can not prepare DDL statements #9425
Comments
@ian-p-cooke |
hi @zimulala , could you elaborate on why you do not currently support preparing DDL statements? I looked at the code and while I'm not well-versed in Go, I did find where you check for that but I couldn't determine what the consequences of using a DDL The reason I went back to look at this is I wondered if you could support DDL statements that have no parameters without much work. For example, if you didn't check for DDL and received literally Why use a prepared statement if there are no parameters? Well, some code I'm working with prepares all the SQL it executes. I have a workaround for that client but I thought that 'DDL statements with no parameters' might be a small step forward for this feature and is something I could do a pull request for. |
I did some testing with a modified tidb-server and some prepared DDL statements appear to work ok. What I'm suggesting is something like: ian-p-cooke@faa575f What I did after modifying PREPARE create_db FROM 'create database blog';
EXECUTE create_db;
DEALLOCATE PREPARE create_db;
use blog;
PREPARE create_table FROM 'create table posts ( id BIGINT )';
EXECUTE create_table;
DEALLOCATE PREPARE create_table; but if you could explain why DDL statements were excluded before I can try and address that. |
I'd like to get back to this over the weekend. Can you explain why you exclude DDL statements from being prepared? It appears to work without any modifications. |
@ian-p-cooke That's ok, the reason why we don't support it because of executing DDL in the prepared statements is just not too common in our user scenarios. |
#10144 closes this issue |
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
use diesel_cli to setup a new database
diesel setup
.a new database in TiDB
Can not prepare DDL statements
I can work around this by patching diesel_cli to not use a prepared statement in this case but it shows an area of incompatibility with MySQL 8.0. MySQL permits 'CREATE TABLE' in prepared statements: https://dev.mysql.com/doc/refman/8.0/en/sql-syntax-prepared-statements.html
Can you permit the same DDL statements as MySQL?
tidb-server -V
or runselect tidb_version();
on TiDB)?| Release Version: v3.0.0-beta-27-g6398788
Git Commit Hash: 6398788
Git Branch: master
UTC Build Time: 2019-01-31 08:42:28
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
The text was updated successfully, but these errors were encountered: