summaryrefslogtreecommitdiff
path: root/mysql-test/t/partition_alter.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-26 22:44:16 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-26 22:45:46 +0300
commit8c81f24d1bedb11364288d42d5492e76816fe20a (patch)
treeaade13bca6207b89634b2b87db16e18301e9ec0e /mysql-test/t/partition_alter.test
parent8f643e2063c9890a353149f39ef85b2cf3151fd0 (diff)
parent808f18c748a98dcc7df0b8154563153c8527d3f0 (diff)
downloadmariadb-git-8c81f24d1bedb11364288d42d5492e76816fe20a.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'mysql-test/t/partition_alter.test')
-rw-r--r--mysql-test/t/partition_alter.test39
1 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test
index 592d8fdaeaa..9194e9a8222 100644
--- a/mysql-test/t/partition_alter.test
+++ b/mysql-test/t/partition_alter.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source include/have_partition.inc
CREATE TABLE `test_data` (
@@ -64,3 +65,41 @@ deallocate prepare stmt;
drop table test_data;
+#
+# MDEV-12389 ADD CHECK leaves an orphaned .par file
+#
+
+--let $datadir=`SELECT @@datadir`
+
+# InnoDB
+create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
+engine=innodb
+partition by range columns (d) (
+partition p1 values less than ('2016-10-18'),
+partition p2 values less than ('2020-10-19'));
+insert t1 values (0, '2000-01-02', 0);
+insert t1 values (1, '2020-01-02', 10);
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CONSTRAINT_FAILED
+alter table t1 add check (b in (0, 1));
+alter table t1 add check (b in (0, 10));
+show create table t1;
+--error ER_CONSTRAINT_FAILED
+insert t1 values (2, '2020-01-03', 20);
+drop table t1;
+--list_files $datadir/test
+
+# MyISAM, different execution path
+create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
+partition by range columns (d) (
+partition p1 values less than ('2016-10-18'),
+partition p2 values less than ('2020-10-19'));
+insert t1 values (0, '2000-01-02', 0);
+insert t1 values (1, '2020-01-02', 10);
+# FIXME: MDEV-12923 MyISAM allows CHECK constraint violation in ALTER TABLE
+alter table t1 add check (b in (0, 1));
+show create table t1;
+--error ER_CONSTRAINT_FAILED
+insert t1 values (2, '2020-01-03', 20);
+drop table t1;
+--list_files $datadir/test