Commit bb53b6ee authored by evgen@moonbone.local's avatar evgen@moonbone.local

Manually merged

parents 1e0138fd ae6970e6
...@@ -3389,3 +3389,9 @@ a t1.b + 0 t1.c + 0 a t2.b + 0 c d ...@@ -3389,3 +3389,9 @@ a t1.b + 0 t1.c + 0 a t2.b + 0 c d
1 0 1 1 0 1 NULL 1 0 1 1 0 1 NULL
2 0 1 NULL NULL NULL NULL 2 0 1 NULL NULL NULL NULL
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1;
i='1e+01' i=1e+01 i in (1e+01) i in ('1e+01')
0 1 1 1
DROP TABLE t1;
...@@ -2285,6 +2285,25 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX (a); ...@@ -2285,6 +2285,25 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
DROP TABLE t1; DROP TABLE t1;
#
# Bug #18759 "Incorrect string to numeric conversion"
#
# This test is here so that the behavior will not be changed to 4.1
# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
# will be converted internally to real (double) value and it is not
# as accurate as bigint (longlong) for integers. Thus the results may
# vary. In 5.1 internally it is decimal, which is a string type and
# will be more accurate. Due to rather big changes needed to fix this
# in 4.1 or 5.0 it is not desired to do it in the stable versions.
#
# This test is here only to make sure that behavior is not changed in
# 4.1 and 5.0
#
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -138,7 +138,8 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems) ...@@ -138,7 +138,8 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
} }
continue; continue;
} }
if ((res= items[i]->real_item()->type()) == Item::FIELD_ITEM) if ((res= items[i]->real_item()->type()) == Item::FIELD_ITEM &&
items[i]->result_type() != INT_RESULT)
{ {
field= ((Item_field *)items[i]->real_item())->field; field= ((Item_field *)items[i]->real_item())->field;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment