summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/t/partition_innodb.test13
-rw-r--r--sql/ha_partition.cc8
2 files changed, 19 insertions, 2 deletions
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 2ce7e89f9f2..21769a8b944 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -577,6 +577,19 @@ connection default;
SELECT * FROM t1;
COMMIT;
DROP TABLE t1;
+
+#
+# Bug #55146 Assertion `m_part_spec.start_part == m_part_spec.end_part' in index_read_idx_map
+#
+
+CREATE TABLE t1 (i1 int NOT NULL primary key, f1 int) ENGINE = InnoDB
+ PARTITION BY HASH(i1) PARTITIONS 2;
+
+INSERT INTO t1 VALUES (1,1), (2,2);
+
+SELECT * FROM t1 WHERE i1 = ( SELECT i1 FROM t1 WHERE f1=0 LIMIT 1 );
+DROP TABLE t1;
+
--enable_parsing
--echo #
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 501eb083a6e..7805bc97d7a 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4382,8 +4382,12 @@ int ha_partition::index_read_idx_map(uchar *buf, uint index,
get_partition_set(table, buf, index, &m_start_key, &m_part_spec);
- /* How can it be more than one partition with the current use? */
- DBUG_ASSERT(m_part_spec.start_part == m_part_spec.end_part);
+ /*
+ We have either found exactly 1 partition
+ (in which case start_part == end_part)
+ or no matching partitions (start_part > end_part)
+ */
+ DBUG_ASSERT(m_part_spec.start_part >= m_part_spec.end_part);
for (part= m_part_spec.start_part; part <= m_part_spec.end_part; part++)
{