From b2c54a9a699daa8ffd9bb500f3405dacd7eb347b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 10 Sep 2014 13:22:20 +0200 Subject: [PATCH] MDEV-6523 CONNECT temporary table created check_engine() was not called for assisted discovery --- sql/sql_table.cc | 6 +++--- .../connect/mysql-test/connect/r/temporary.result | 6 ++++++ storage/connect/mysql-test/connect/t/temporary.test | 13 +++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 storage/connect/mysql-test/connect/r/temporary.result create mode 100644 storage/connect/mysql-test/connect/t/temporary.test diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5f2f1141a04..ca1290b2753 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4372,9 +4372,6 @@ handler *mysql_create_frm_image(THD *thd, DBUG_RETURN(NULL); } - if (check_engine(thd, db, table_name, create_info)) - DBUG_RETURN(NULL); - set_table_default_charset(thd, create_info, (char*) db); db_options= create_info->table_options; @@ -4780,6 +4777,9 @@ int create_table_impl(THD *thd, THD_STAGE_INFO(thd, stage_creating_table); + if (check_engine(thd, orig_db, orig_table_name, create_info)) + goto err; + if (create_table_mode == C_ASSISTED_DISCOVERY) { /* check that it's used correctly */ diff --git a/storage/connect/mysql-test/connect/r/temporary.result b/storage/connect/mysql-test/connect/r/temporary.result new file mode 100644 index 00000000000..c4e992f2a64 --- /dev/null +++ b/storage/connect/mysql-test/connect/r/temporary.result @@ -0,0 +1,6 @@ +CREATE TEMPORARY TABLE t1 (a int not null) +ENGINE=CONNECT table_type=MYSQL CONNECTION='mysql://root@127.0.0.1/test/t2'; +ERROR HY000: Table storage engine 'CONNECT' does not support the create option 'TEMPORARY' +CREATE TEMPORARY TABLE t1 +ENGINE=CONNECT table_type=MYSQL CONNECTION='mysql://root@127.0.0.1/test/t2'; +ERROR HY000: Table storage engine 'CONNECT' does not support the create option 'TEMPORARY' diff --git a/storage/connect/mysql-test/connect/t/temporary.test b/storage/connect/mysql-test/connect/t/temporary.test new file mode 100644 index 00000000000..dda066c874b --- /dev/null +++ b/storage/connect/mysql-test/connect/t/temporary.test @@ -0,0 +1,13 @@ +# +# CONNECT tables cannot be TEMPORARY +# + +--error ER_ILLEGAL_HA_CREATE_OPTION +CREATE TEMPORARY TABLE t1 (a int not null) + ENGINE=CONNECT table_type=MYSQL CONNECTION='mysql://root@127.0.0.1/test/t2'; + +# also with assisted discovery +--error ER_ILLEGAL_HA_CREATE_OPTION +CREATE TEMPORARY TABLE t1 + ENGINE=CONNECT table_type=MYSQL CONNECTION='mysql://root@127.0.0.1/test/t2'; +