diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 8b95f4e7e12..05350db1ee0 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1985,4 +1985,23 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM PARTITION BY HASH(id) PARTITIONS 2; DROP TABLE t1; SET SESSION SQL_MODE=DEFAULT; +# +# BUG#45816 - assertion failure with index containing double +# column on partitioned table +# +CREATE TABLE t1 ( +a INT DEFAULT NULL, +b DOUBLE DEFAULT NULL, +c INT DEFAULT NULL, +KEY idx2(b,a) +) PARTITION BY HASH(c) PARTITIONS 3; +INSERT INTO t1 VALUES (6,8,9); +INSERT INTO t1 VALUES (6,8,10); +SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE; +1 +1 +1 +1 +1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 542a992bb0e..0b497d86623 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1979,4 +1979,23 @@ CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM DROP TABLE t1; SET SESSION SQL_MODE=DEFAULT; + +--echo # +--echo # BUG#45816 - assertion failure with index containing double +--echo # column on partitioned table +--echo # + +CREATE TABLE t1 ( + a INT DEFAULT NULL, + b DOUBLE DEFAULT NULL, + c INT DEFAULT NULL, + KEY idx2(b,a) +) PARTITION BY HASH(c) PARTITIONS 3; + +INSERT INTO t1 VALUES (6,8,9); +INSERT INTO t1 VALUES (6,8,10); + +SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE; + +DROP TABLE t1; --echo End of 5.1 tests diff --git a/sql/field.cc b/sql/field.cc index 452dfc3ae55..3bfb54fbd15 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4598,7 +4598,6 @@ bool Field_double::send_binary(Protocol *protocol) int Field_double::cmp(const uchar *a_ptr, const uchar *b_ptr) { - ASSERT_COLUMN_MARKED_FOR_READ; double a,b; #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 562716a7db7..b345648260c 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3730,7 +3730,7 @@ int ha_partition::index_init(uint inx, bool sorted) */ if (m_lock_type == F_WRLCK) bitmap_union(table->read_set, &m_part_info->full_part_field_set); - else if (sorted) + if (sorted) { /* An ordered scan is requested. We must make sure all fields of the