summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/invisible_partition.result18
-rw-r--r--mysql-test/main/invisible_partition.test23
-rw-r--r--sql/sql_partition.cc11
3 files changed, 52 insertions, 0 deletions
diff --git a/mysql-test/main/invisible_partition.result b/mysql-test/main/invisible_partition.result
new file mode 100644
index 00000000000..4380083c352
--- /dev/null
+++ b/mysql-test/main/invisible_partition.result
@@ -0,0 +1,18 @@
+CREATE TABLE t1 (a INT NOT NULL, KEY (a)) ENGINE=MEMORY PARTITION BY KEY(a) PARTITIONS 4;
+INSERT INTO t1 VALUES (1),(2);
+SET debug_dbug="+d,test_pseudo_invisible";
+ALTER TABLE t1 REBUILD PARTITION p2;
+ERROR HY000: Internal error: Don't to it with test_pseudo_invisible
+SET debug_dbug='';
+ALTER TABLE t1 REPAIR PARTITION p1,p2,p3;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+Drop table t1;
+CREATE TABLE t1 (i INT) PARTITION BY HASH (i) PARTITIONS 3;
+SET debug_dbug= "+d,test_pseudo_invisible";
+ALTER TABLE t1 COALESCE PARTITION 1;
+ERROR HY000: Internal error: Don't to it with test_pseudo_invisible
+SET debug_dbug= "";
+SELECT * FROM t1;
+i
+DROP TABLE t1;
diff --git a/mysql-test/main/invisible_partition.test b/mysql-test/main/invisible_partition.test
new file mode 100644
index 00000000000..0a016be1357
--- /dev/null
+++ b/mysql-test/main/invisible_partition.test
@@ -0,0 +1,23 @@
+--source include/have_partition.inc
+--source include/have_binlog_format_row.inc
+
+CREATE TABLE t1 (a INT NOT NULL, KEY (a)) ENGINE=MEMORY PARTITION BY KEY(a) PARTITIONS 4;
+INSERT INTO t1 VALUES (1),(2);
+SET debug_dbug="+d,test_pseudo_invisible";
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 REBUILD PARTITION p2;
+SET debug_dbug='';
+ALTER TABLE t1 REPAIR PARTITION p1,p2,p3;
+
+# Cleanup
+Drop table t1;
+#Mdev-14850
+CREATE TABLE t1 (i INT) PARTITION BY HASH (i) PARTITIONS 3;
+SET debug_dbug= "+d,test_pseudo_invisible";
+--error ER_INTERNAL_ERROR
+ALTER TABLE t1 COALESCE PARTITION 1;
+SET debug_dbug= "";
+SELECT * FROM t1;
+
+# Cleanup
+DROP TABLE t1;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index c5c39a26da1..634c120511a 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4872,6 +4872,17 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
ALTER_PARTITION_TABLE_REORG |
ALTER_PARTITION_REBUILD))
{
+ /*
+ You can't add column when we are doing alter related to partition
+ */
+ DBUG_EXECUTE_IF("test_pseudo_invisible", {
+ my_error(ER_INTERNAL_ERROR, MYF(0), "Don't to it with test_pseudo_invisible");
+ DBUG_RETURN(1);
+ });
+ DBUG_EXECUTE_IF("test_completely_invisible", {
+ my_error(ER_INTERNAL_ERROR, MYF(0), "Don't to it with test_completely_invisible");
+ DBUG_RETURN(1);
+ });
partition_info *tab_part_info;
ulonglong flags= 0;
bool is_last_partition_reorged= FALSE;