diff options
author | unknown <monty@mysql.com> | 2005-04-29 17:03:34 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-04-29 17:03:34 +0300 |
commit | 97b0821462cd21d5051b3264f072ea3d4a7a8d7f (patch) | |
tree | 0caae1ad50324015508cbda7e4ef72f92ca69c25 /mysql-test/t/cast.test | |
parent | 2a69f0049b3fd6e765e2f58a81ea7b5e3d5dcd1c (diff) | |
download | mariadb-git-97b0821462cd21d5051b3264f072ea3d4a7a8d7f.tar.gz |
CAST(string_argument AS UNSIGNED) didn't work for big integers above the signed range. (Bug #7036)
Produce warnings of wrong cast of strings to signed/unsigned.
Don't block not resolved IP's if DNS server is down (Bug #8467)
Fix compiler problems with MinGW (Bug #8872)
configure.in:
Fix compiler problems with MinGW (Bug #8872)
include/config-win.h:
Fix compiler problems with MinGW (Bug #8872)
include/my_global.h:
Fix compiler problems with MinGW (Bug #8872)
mysql-test/r/cast.result:
Test for cast to signed/unsigned outside of range (Bug #7036)
mysql-test/t/cast.test:
Test for cast to signed/unsigned outside of range (Bug #7036)
mysys/default.c:
Cleanup (combine identical code).
Done mainly by Jani
sql/field.h:
Added cast_to_int_type() to ensure that enums are casted as numbers
sql/hostname.cc:
Don't block not resolved IP's if DNS server is down (Bug #8467)
sql/item.h:
Added cast_to_int_type() to ensure that enums are casted as numbers
sql/item_func.cc:
CAST(string_argument AS UNSIGNED) didn't work for big integers above the
signed range. (Bug #7036)
Produce warnings of wrong cast of strings to signed/unsigned
sql/item_func.h:
CAST(string_argument AS UNSIGNED) didn't work for big integers above the
signed range. (Bug #7036)
Diffstat (limited to 'mysql-test/t/cast.test')
-rw-r--r-- | mysql-test/t/cast.test | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test index 23bba7d5aff..aeab81585f0 100644 --- a/mysql-test/t/cast.test +++ b/mysql-test/t/cast.test @@ -4,7 +4,6 @@ select CAST(1-2 AS UNSIGNED); select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER); -select CONVERT('-1',UNSIGNED); select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1; select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1; select ~5, cast(~5 as signed); @@ -22,6 +21,15 @@ select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4)); select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4)); select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4)); +# out-of-range cases +select cast('18446744073709551616' as unsigned); +select cast('18446744073709551616' as signed); +select cast('9223372036854775809' as signed); +select cast('-1' as unsigned); +select cast('abc' as signed); +select cast('1a' as signed); +select cast('' as signed); + # # Character set convertion # @@ -118,3 +126,19 @@ select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour); select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00'); # Still we should not throw away "days" part of time value select timediff(cast('1 12:00:00' as time), '12:00:00'); + +# +# Bug #7036: Casting from string to unsigned would cap value of result at +# maximum signed value instead of maximum unsigned value +# +select cast(18446744073709551615 as unsigned); +select cast(18446744073709551615 as signed); +select cast('18446744073709551615' as unsigned); +select cast('18446744073709551615' as signed); +select cast('9223372036854775807' as signed); + +select cast(concat('184467440','73709551615') as unsigned); +select cast(concat('184467440','73709551615') as signed); + +select cast(repeat('1',20) as unsigned); +select cast(repeat('1',20) as signed); |