summaryrefslogtreecommitdiff
path: root/mysql-test/r/cast.result
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-04-29 17:03:34 +0300
committerunknown <monty@mysql.com>2005-04-29 17:03:34 +0300
commit97b0821462cd21d5051b3264f072ea3d4a7a8d7f (patch)
tree0caae1ad50324015508cbda7e4ef72f92ca69c25 /mysql-test/r/cast.result
parent2a69f0049b3fd6e765e2f58a81ea7b5e3d5dcd1c (diff)
downloadmariadb-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/r/cast.result')
-rw-r--r--mysql-test/r/cast.result71
1 files changed, 68 insertions, 3 deletions
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 636e2603f9b..7cd0934f7a3 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -4,9 +4,6 @@ CAST(1-2 AS UNSIGNED)
select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER);
CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER)
-1
-select CONVERT('-1',UNSIGNED);
-CONVERT('-1',UNSIGNED)
-18446744073709551615
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
18446744073709551611 18446744073709551611
@@ -57,6 +54,41 @@ CONVERT(DATE "2004-01-22 21:45:33",BINARY(4))
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
2004
+select cast('18446744073709551616' as unsigned);
+cast('18446744073709551616' as unsigned)
+18446744073709551615
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '18446744073709551616'
+select cast('18446744073709551616' as signed);
+cast('18446744073709551616' as signed)
+-1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '18446744073709551616'
+select cast('9223372036854775809' as signed);
+cast('9223372036854775809' as signed)
+-9223372036854775807
+Warnings:
+Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
+select cast('-1' as unsigned);
+cast('-1' as unsigned)
+18446744073709551615
+Warnings:
+Warning 1105 Cast to unsigned converted negative integer to it's positive complement
+select cast('abc' as signed);
+cast('abc' as signed)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'abc'
+select cast('1a' as signed);
+cast('1a' as signed)
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1a'
+select cast('' as signed);
+cast('' as signed)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
set names binary;
select cast(_latin1'test' as char character set latin2);
cast(_latin1'test' as char character set latin2)
@@ -187,3 +219,36 @@ timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
select timediff(cast('1 12:00:00' as time), '12:00:00');
timediff(cast('1 12:00:00' as time), '12:00:00')
24:00:00
+select cast(18446744073709551615 as unsigned);
+cast(18446744073709551615 as unsigned)
+18446744073709551615
+select cast(18446744073709551615 as signed);
+cast(18446744073709551615 as signed)
+-1
+select cast('18446744073709551615' as unsigned);
+cast('18446744073709551615' as unsigned)
+18446744073709551615
+select cast('18446744073709551615' as signed);
+cast('18446744073709551615' as signed)
+-1
+Warnings:
+Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
+select cast('9223372036854775807' as signed);
+cast('9223372036854775807' as signed)
+9223372036854775807
+select cast(concat('184467440','73709551615') as unsigned);
+cast(concat('184467440','73709551615') as unsigned)
+18446744073709551615
+select cast(concat('184467440','73709551615') as signed);
+cast(concat('184467440','73709551615') as signed)
+-1
+Warnings:
+Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
+select cast(repeat('1',20) as unsigned);
+cast(repeat('1',20) as unsigned)
+11111111111111111111
+select cast(repeat('1',20) as signed);
+cast(repeat('1',20) as signed)
+-7335632962598440505
+Warnings:
+Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement