summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2019-11-01 09:39:43 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2019-11-01 09:39:43 +0400
commit6dce6aecebe6ef78a14cb5c5c5daa8a355551e40 (patch)
tree5634fcc0dd38530086186214895f8150e7e0c8ae /mysql-test/main
parent55b2281a5da38f66dca5e2180672f570c33676df (diff)
downloadmariadb-git-6dce6aecebe6ef78a14cb5c5c5daa8a355551e40.tar.gz
MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val.
Partition table with the AUTO_INCREMENT column we ahve to check if the max value is properly loaded. So we need to open all tables in INSERT PARTITION statement if necessary. Also we need to check if some tables are pruned away and not count the max autoincrement in this case.
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/partition_innodb.result24
-rw-r--r--mysql-test/main/partition_innodb.test20
2 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result
index f3d24347ff9..5c63fcfbbc9 100644
--- a/mysql-test/main/partition_innodb.result
+++ b/mysql-test/main/partition_innodb.result
@@ -1028,5 +1028,29 @@ COUNT(*)
2
DROP TABLE t1;
#
+# MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
+#
+CREATE TABLE t1 (a INT)
+ENGINE=InnoDB
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (6),
+PARTITION pn VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (4),(5),(6);
+ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
+UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
+INSERT INTO t1 PARTITION(p0) VALUES ();
+ERROR HY000: Found a row not matching the given partition set
+INSERT INTO t1 PARTITION(p0) VALUES (-1);
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+a
+-1
+1
+3
+4
+6
+DROP TABLE t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test
index 629bc29e758..f7ce9b03a54 100644
--- a/mysql-test/main/partition_innodb.test
+++ b/mysql-test/main/partition_innodb.test
@@ -1106,5 +1106,25 @@ SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
DROP TABLE t1;
--echo #
+--echo # MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
+--echo #
+
+CREATE TABLE t1 (a INT)
+ ENGINE=InnoDB
+ PARTITION BY RANGE (a) (
+ PARTITION p0 VALUES LESS THAN (6),
+ PARTITION pn VALUES LESS THAN MAXVALUE
+ );
+INSERT INTO t1 VALUES (4),(5),(6);
+ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
+UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
+--error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
+INSERT INTO t1 PARTITION(p0) VALUES ();
+INSERT INTO t1 PARTITION(p0) VALUES (-1);
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.3 tests
--echo #