summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_in.test
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.gmz>2007-03-02 16:25:56 +0200
committerunknown <gkodinov/kgeorge@macbook.gmz>2007-03-02 16:25:56 +0200
commitb114118ab77b36ccc3549542252f5ea2796bbc33 (patch)
tree063e0ea949c0c8921128bb894268763c63ea4220 /mysql-test/t/func_in.test
parentd4b4952f8b8e470fc68aea2cf2f91c1dc9b6452f (diff)
downloadmariadb-git-b114118ab77b36ccc3549542252f5ea2796bbc33.tar.gz
Bug #19342:
Several problems here : 1. The conversion to double of an hex string const item was not taking into account the unsigned flag. 2. IN was not behaving in the same was way as comparisons when performed over an INT/DATE/DATETIME/TIMESTAMP column and a constant. The ordinary comparisons in that case convert the constant to an INTEGER value and do int comparisons. Fixed the IN to do the same. 3. IN is not taking into account the unsigned flag when calculating <expr> IN (<int_const1>, <int_const2>, ...). Extended the implementation of IN to store and process the unsigned flag for its arguments. mysql-test/r/func_in.result: Bug #19342: test case mysql-test/t/func_in.test: Bug #19342: test case sql/item.h: Bug #19342: correct handling of sign in conersion to real. sql/item_cmpfunc.cc: Bug #19342: exteneded the IN values list to support unsigned longlong values. Correct comparison of integers in IN with regard of signedness. Compare DATE/DATETIME/TIMESTAMP values as integers in IN. sql/item_cmpfunc.h: Bug #19342: exteneded the IN values list to support unsigned longlong values. Correct comparison of integers in IN with regard of signedness.
Diffstat (limited to 'mysql-test/t/func_in.test')
-rw-r--r--mysql-test/t/func_in.test58
1 files changed, 58 insertions, 0 deletions
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 54b81bed133..7ba54747d4b 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -298,4 +298,62 @@ SELECT STRAIGHT_JOIN
DROP TABLE t1,t2,t3,t4;
+#
+# BUG#19342: IN works incorrectly for BIGINT UNSIGNED values
+#
+CREATE TABLE t1(a BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
+
+SELECT * FROM t1 WHERE a=-1 OR a=-2 ;
+SELECT * FROM t1 WHERE a IN (-1, -2);
+
+CREATE TABLE t2 (a BIGINT UNSIGNED);
+insert into t2 values(13491727406643098568),
+ (0x7fffffefffffffff),
+ (0x7ffffffeffffffff),
+ (0x7fffffffefffffff),
+ (0x7ffffffffeffffff),
+ (0x7fffffffffefffff),
+ (0x7ffffffffffeffff),
+ (0x7fffffffffffefff),
+ (0x7ffffffffffffeff),
+ (0x7fffffffffffffef),
+ (0x7ffffffffffffffe),
+ (0x7fffffffffffffff),
+ (0x8000000000000000),
+ (0x8000000000000001),
+ (0x8000000000000002),
+ (0x8000000000000300),
+ (0x8000000000000400),
+ (0x8000000000000401),
+ (0x8000000000004001),
+ (0x8000000000040001),
+ (0x8000000000400001),
+ (0x8000000004000001),
+ (0x8000000040000001),
+ (0x8000000400000001),
+ (0x8000004000000001),
+ (0x8000040000000001);
+
+SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42);
+
+SELECT HEX(a) FROM t2 WHERE a IN
+(0xBB3C3E98175D33C8,
+ 0x7fffffffffffffff,
+ 0x8000000000000000,
+ 0x8000000000000400,
+ 0x8000000000000401,
+ 42);
+
+SELECT HEX(a) FROM t2 WHERE a IN (0x7fffffffffffffff,0x8000000000000001);
+SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff);
+SELECT HEX(a) FROM t2 WHERE a IN (0x7ffffffffffffffe,0x7fffffffffffffff,'abc');
+
+CREATE TABLE t3 (a BIGINT UNSIGNED);
+INSERT INTO t3 VALUES (9223372036854775551);
+
+SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42);
+
+DROP TABLE t1,t2,t3;
+
--echo End of 5.0 tests