diff options
-rw-r--r-- | mysql-test/suite/parts/r/mdev_21007.result | 5 | ||||
-rw-r--r-- | mysql-test/suite/parts/t/mdev_21007.test | 9 | ||||
-rw-r--r-- | sql/ha_partition.cc | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/mysql-test/suite/parts/r/mdev_21007.result b/mysql-test/suite/parts/r/mdev_21007.result new file mode 100644 index 00000000000..fb2417ac3ae --- /dev/null +++ b/mysql-test/suite/parts/r/mdev_21007.result @@ -0,0 +1,5 @@ +CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY; +UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/mdev_21007.test b/mysql-test/suite/parts/t/mdev_21007.test new file mode 100644 index 00000000000..ec6fbe4d108 --- /dev/null +++ b/mysql-test/suite/parts/t/mdev_21007.test @@ -0,0 +1,9 @@ +--source include/have_partition.inc + +CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY; +UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1; + +# Cleanup +DROP TABLE t1; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 06ae329ee3a..4b153ba1135 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -8413,7 +8413,9 @@ int ha_partition::info(uint flag) file->stats.auto_increment_value); } while (*(++file_array)); - DBUG_ASSERT(auto_increment_value); + if (all_parts_opened) { + DBUG_ASSERT(auto_increment_value); + } stats.auto_increment_value= auto_increment_value; if (all_parts_opened && auto_inc_is_first_in_idx) { |