Commit e61eb742 authored by unknown's avatar unknown

Merge mysql.com:/home/kgeorge/mysql/5.0/clean

into  mysql.com:/home/kgeorge/mysql/5.0/B19700


sql/item.h:
  Auto merged
parents f63e1728 a2f861f5
...@@ -3183,3 +3183,24 @@ select * from (select min(i) from t1 where j=(select * from (select min(j) from ...@@ -3183,3 +3183,24 @@ select * from (select min(i) from t1 where j=(select * from (select min(j) from
min(i) min(i)
1 1
drop table t1; 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;
...@@ -2109,3 +2109,25 @@ insert into t1 values (1, 2), (2, 2), (3, 2); ...@@ -2109,3 +2109,25 @@ insert into t1 values (1, 2), (2, 2), (3, 2);
select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3; select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
drop table t1; 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;
...@@ -2245,6 +2245,7 @@ public: ...@@ -2245,6 +2245,7 @@ public:
max_length= item->max_length; max_length= item->max_length;
decimals= item->decimals; decimals= item->decimals;
collation.set(item->collation); collation.set(item->collation);
unsigned_flag= item->unsigned_flag;
return 0; return 0;
}; };
virtual void store(Item *)= 0; virtual void store(Item *)= 0;
......
...@@ -404,6 +404,7 @@ void Item_singlerow_subselect::fix_length_and_dec() ...@@ -404,6 +404,7 @@ void Item_singlerow_subselect::fix_length_and_dec()
engine->fix_length_and_dec(row); engine->fix_length_and_dec(row);
value= *row; value= *row;
} }
unsigned_flag= value->unsigned_flag;
/* /*
If there are not tables in subquery then ability to have NULL value 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 depends on SELECT list (if single row subquery have tables then it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment