Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-10-30 09:52:50+04:00, holyfoot@stripped +4 -0
Bug #8663 (cant use bigint as input to CAST)
decimal->ulong conversion fixed to assign max possible ULONG if decimal
is bigger
Item_func_unsigned now handles DECIMAL parameter separately as we can't
rely on decimal::val_int result here.
mysql-test/r/type_newdecimal.result@stripped, 2006-10-30 09:52:47+04:00, holyfoot@stripped
+5 -0
result fixed
mysql-test/t/type_newdecimal.test@stripped, 2006-10-30 09:52:47+04:00, holyfoot@stripped +6
-0
testcase
sql/item_func.cc@stripped, 2006-10-30 09:52:47+04:00, holyfoot@stripped +8 -1
DECIMAL_RESULT should be handled separately here as it's
always signed.
strings/decimal.c@stripped, 2006-10-30 09:52:47+04:00, holyfoot@stripped +1 -1
here we assign max possible ULONG if the decimal value is bigger
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: holyfoot
# Host: deer.(none)
# Root: /home/hf/work/8663/my50-8663
--- 1.308/sql/item_func.cc 2006-10-30 09:52:58 +04:00
+++ 1.309/sql/item_func.cc 2006-10-30 09:52:58 +04:00
@@ -964,7 +964,14 @@ longlong Item_func_unsigned::val_int()
longlong value;
int error;
- if (args[0]->cast_to_int_type() != STRING_RESULT)
+ if (args[0]->cast_to_int_type() == DECIMAL_RESULT)
+ {
+ my_decimal tmp, *dec= args[0]->val_decimal(&tmp);
+ if (!(null_value= args[0]->null_value))
+ my_decimal2int(E_DEC_FATAL_ERROR, dec, 1, &value);
+ return value;
+ }
+ else if (args[0]->cast_to_int_type() != STRING_RESULT)
{
value= args[0]->val_int();
null_value= args[0]->null_value;
--- 1.41/mysql-test/r/type_newdecimal.result 2006-10-30 09:52:58 +04:00
+++ 1.42/mysql-test/r/type_newdecimal.result 2006-10-30 09:52:58 +04:00
@@ -1412,3 +1412,8 @@ i2 count(distinct j)
1.0 2
2.0 2
drop table t1;
+select cast(19999999999999999999 as unsigned);
+cast(19999999999999999999 as unsigned)
+18446744073709551615
+Warnings:
+Error 1292 Truncated incorrect DECIMAL value: ''
--- 1.38/mysql-test/t/type_newdecimal.test 2006-10-30 09:52:58 +04:00
+++ 1.39/mysql-test/t/type_newdecimal.test 2006-10-30 09:52:58 +04:00
@@ -1108,3 +1108,9 @@ insert into t1 values (1,1), (1,2), (2,3
select i, count(distinct j) from t1 group by i;
select i+0.0 as i2, count(distinct j) from t1 group by i2;
drop table t1;
+
+#
+# Bug #8663 (cant use bigint as input to CAST)
+#
+select cast(19999999999999999999 as unsigned);
+
--- 1.70/strings/decimal.c 2006-10-30 09:52:58 +04:00
+++ 1.71/strings/decimal.c 2006-10-30 09:52:58 +04:00
@@ -1036,7 +1036,7 @@ int decimal2ulonglong(decimal_t *from, u
x=x*DIG_BASE + *buf++;
if (unlikely(y > ((ulonglong) ULONGLONG_MAX/DIG_BASE) || x < y))
{
- *to=y;
+ *to=ULONGLONG_MAX;
return E_DEC_OVERFLOW;
}
}
| Thread |
|---|
| • bk commit into 5.0 tree (holyfoot:1.2289) BUG#8663 | holyfoot | 30 Oct |