summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb-alter-table.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/innodb/t/innodb-alter-table.test')
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test
index 97f0075f344..0cf456ad146 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-table.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-table.test
@@ -1,4 +1,5 @@
--source include/innodb_page_size.inc
+--source include/have_partition.inc
#
# MMDEV-8386: MariaDB creates very big tmp file and hangs on xtradb
@@ -171,3 +172,35 @@ ALTER TABLE ticket
SHOW CREATE TABLE ticket;
DROP TABLE ticket;
+
+#
+# MDEV-13838: Wrong result after altering a partitioned table
+#
+
+CREATE TABLE t (
+id bigint(20) unsigned NOT NULL auto_increment,
+d date NOT NULL,
+a bigint(20) unsigned NOT NULL,
+b smallint(5) unsigned DEFAULT NULL,
+PRIMARY KEY (id,d)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs STATS_SAMPLE_PAGES=2
+PARTITION BY RANGE COLUMNS(d)
+(
+PARTITION p20170914 VALUES LESS THAN ('2017-09-15') ENGINE = InnoDB,
+PARTITION p99991231 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB);
+
+insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10);
+insert into t(d,a,b) values ('2017-09-15',rand()*10000,rand()*10);
+
+replace into t(d,a,b) select '2017-09-15',rand()*10000,rand()*10 from t t1, t t2, t t3, t t4;
+
+select count(*) from t where d ='2017-09-15';
+
+ALTER TABLE t CHANGE b c smallint(5) unsigned , ADD KEY idx_d_a (d, a);
+SHOW CREATE TABLE t;
+analyze table t;
+
+select count(*) from t where d ='2017-09-15';
+select count(*) from t force index(primary) where d ='2017-09-15';
+
+DROP TABLE t;