summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/select.result10
-rw-r--r--mysql-test/t/select.test9
-rw-r--r--sql/item_cmpfunc.cc2
3 files changed, 20 insertions, 1 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index d0b2a575a32..1750051289a 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4609,4 +4609,14 @@ HAVING v <= 't'
ORDER BY pk;
v
DROP TABLE t1;
+#
+# Bug#49489 Uninitialized cache led to a wrong result.
+#
+CREATE TABLE t1(c1 DOUBLE(5,4));
+INSERT INTO t1 VALUES (9.1234);
+SELECT * FROM t1 WHERE c1 < 9.12345;
+c1
+9.1234
+DROP TABLE t1;
+# End of test for bug#49489.
End of 5.1 tests
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index ac65e5cbaf5..982aec726f7 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3964,4 +3964,13 @@ ORDER BY pk;
DROP TABLE t1;
+--echo #
+--echo # Bug#49489 Uninitialized cache led to a wrong result.
+--echo #
+CREATE TABLE t1(c1 DOUBLE(5,4));
+INSERT INTO t1 VALUES (9.1234);
+SELECT * FROM t1 WHERE c1 < 9.12345;
+DROP TABLE t1;
+--echo # End of test for bug#49489.
+
--echo End of 5.1 tests
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 5415d6f4f8a..a3c3051d790 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1023,7 +1023,7 @@ Item** Arg_comparator::cache_converted_constant(THD *thd, Item **value,
(*value)->const_item() && type != (*value)->result_type())
{
Item_cache *cache= Item_cache::get_cache(*value, type);
- cache->store(*value);
+ cache->setup(*value);
*cache_item= cache;
return cache_item;
}