Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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
1.2139 06/05/25 10:39:18 gkodinov@stripped +4 -0
Bug #19700: subselect returning BIGINT always returned it as SIGNED
The unsigned flag in Item was not propagated through the single value subqueries.
This caused the result to be treated as signed.
sql/item_subselect.cc
1.126 06/05/25 10:39:13 gkodinov@stripped +1 -0
Preserved the unsigned flag in Item_subselect
sql/item.h
1.198 06/05/25 10:39:13 gkodinov@stripped +1 -0
Preserved the unsigned flag in Item_subselect
mysql-test/t/subselect.test
1.119 06/05/25 10:39:13 gkodinov@stripped +22 -0
Added testcases for bug #19700
mysql-test/r/subselect.result
1.144 06/05/25 10:39:13 gkodinov@stripped +21 -0
Added testcases for bug #19700
# 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: gkodinov
# Host: rakia.(none)
# Root: /home/kgeorge/mysql/5.0/B19700
--- 1.197/sql/item.h 2006-05-17 23:53:32 +03:00
+++ 1.198/sql/item.h 2006-05-25 10:39:13 +03:00
@@ -2243,6 +2243,7 @@
max_length= item->max_length;
decimals= item->decimals;
collation.set(item->collation);
+ unsigned_flag= item->unsigned_flag;
return 0;
};
virtual void store(Item *)= 0;
--- 1.143/mysql-test/r/subselect.result 2006-05-17 23:51:16 +03:00
+++ 1.144/mysql-test/r/subselect.result 2006-05-25 10:39:13 +03:00
@@ -3183,3 +3183,24 @@
min(i)
1
drop table t1;
+CREATE TABLE t1 (i BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (10000000000000000000);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (i BIGINT UNSIGNED);
+INSERT INTO t2 VALUES (10000000000000000000);
+INSERT INTO t2 VALUES (1);
+/* simple test */
+SELECT t1.i FROM t1 JOIN t2 ON t1.i = t2.i;
+i
+10000000000000000000
+1
+/* subquery test */
+SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
+i
+10000000000000000000
+/* subquery test with cast*/
+SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
+i
+10000000000000000000
+DROP TABLE t1;
+DROP TABLE t2;
--- 1.118/mysql-test/t/subselect.test 2006-05-17 23:50:57 +03:00
+++ 1.119/mysql-test/t/subselect.test 2006-05-25 10:39:13 +03:00
@@ -2109,3 +2109,25 @@
select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
drop table t1;
+#
+# Bug#19700: subselect returning BIGINT always returned it as SIGNED
+#
+CREATE TABLE t1 (i BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (10000000000000000000); -- > MAX SIGNED BIGINT 9323372036854775807
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (i BIGINT UNSIGNED);
+INSERT INTO t2 VALUES (10000000000000000000); -- same as first table
+INSERT INTO t2 VALUES (1);
+
+/* simple test */
+SELECT t1.i FROM t1 JOIN t2 ON t1.i = t2.i;
+
+/* subquery test */
+SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
+
+/* subquery test with cast*/
+SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
+
+DROP TABLE t1;
+DROP TABLE t2;
--- 1.125/sql/item_subselect.cc 2006-05-17 23:51:35 +03:00
+++ 1.126/sql/item_subselect.cc 2006-05-25 10:39:13 +03:00
@@ -404,6 +404,7 @@
engine->fix_length_and_dec(row);
value= *row;
}
+ unsigned_flag= value->unsigned_flag;
/*
If there are not tables in subquery then ability to have NULL value
depends on SELECT list (if single row subquery have tables then it
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2139) BUG#19700 | kgeorge | 25 May |