summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/partition.result19
-rw-r--r--mysql-test/t/partition.test29
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/sql_partition.cc15
4 files changed, 59 insertions, 6 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index f7eda649dd2..2e5fa4b9195 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1219,4 +1219,23 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
id
22589
drop table t1, t2;
+set @org_mode=@@sql_mode;
+set @@sql_mode='NO_DIR_IN_CREATE';
+select @@sql_mode;
+@@sql_mode
+NO_DIR_IN_CREATE
+create table t1 (i int )
+partition by range (i)
+(
+partition p01 values less than (1000)
+data directory='/not/existing'
+ index directory='/not/existing'
+);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
+DROP TABLE t1, t2;
+set @@sql_mode=@org_mode;
End of 5.1 tests
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 7d7ef95626a..399f3c4a41d 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1463,4 +1463,33 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
drop table t1, t2;
+#
+# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
+#
+
+disable_query_log;
+eval create table t2 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory="$MYSQLTEST_VARDIR/master-data/test/"
+ index directory="$MYSQLTEST_VARDIR/master-data/test/"
+);
+enable_query_log;
+
+set @org_mode=@@sql_mode;
+set @@sql_mode='NO_DIR_IN_CREATE';
+select @@sql_mode;
+create table t1 (i int )
+partition by range (i)
+(
+ partition p01 values less than (1000)
+ data directory='/not/existing'
+ index directory='/not/existing'
+);
+
+show create table t2;
+DROP TABLE t1, t2;
+set @@sql_mode=@org_mode;
+
--echo End of 5.1 tests
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 98c2e5432ab..e0d2236d804 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -776,6 +776,8 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
partition_element *part_elem= part_it++;
if (part_elem->engine_type == NULL)
part_elem->engine_type= default_engine_type;
+ if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
+ part_elem->data_file_name= part_elem->index_file_name= 0;
if (!is_sub_partitioned())
{
if (check_table_name(part_elem->partition_name,
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index dbac53ed5f6..0dae41e7bad 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1892,12 +1892,15 @@ static int add_partition_options(File fptr, partition_element *p_elem)
err+= add_keyword_int(fptr,"MAX_ROWS",(longlong)p_elem->part_max_rows);
if (p_elem->part_min_rows)
err+= add_keyword_int(fptr,"MIN_ROWS",(longlong)p_elem->part_min_rows);
- if (p_elem->data_file_name)
- err+= add_keyword_string(fptr, "DATA DIRECTORY", TRUE,
- p_elem->data_file_name);
- if (p_elem->index_file_name)
- err+= add_keyword_string(fptr, "INDEX DIRECTORY", TRUE,
- p_elem->index_file_name);
+ if (!(current_thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
+ {
+ if (p_elem->data_file_name)
+ err+= add_keyword_string(fptr, "DATA DIRECTORY", TRUE,
+ p_elem->data_file_name);
+ if (p_elem->index_file_name)
+ err+= add_keyword_string(fptr, "INDEX DIRECTORY", TRUE,
+ p_elem->index_file_name);
+ }
if (p_elem->part_comment)
err+= add_keyword_string(fptr, "COMMENT", TRUE, p_elem->part_comment);
return err + add_engine(fptr,p_elem->engine_type);