diff options
author | unknown <sergefp@mysql.com> | 2005-04-18 07:26:23 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2005-04-18 07:26:23 +0400 |
commit | 11652c1f45f1c6be6c15abfe926da1cef1b8b4f9 (patch) | |
tree | 5fc1e3795dc327d3d082cc3a217cbe7058e6a34a | |
parent | b51f70b81e6af314093dd28728a3dc68d1a28fff (diff) | |
download | mariadb-git-11652c1f45f1c6be6c15abfe926da1cef1b8b4f9.tar.gz |
Fix for BUG#9298: Make int->string conversion sign-aware in Protocol_simple::store_long
mysql-test/r/group_by.result:
Testcase for BUG#9298
mysql-test/t/group_by.test:
Testcase for BUG#9298
-rw-r--r-- | mysql-test/r/group_by.result | 9 | ||||
-rw-r--r-- | mysql-test/t/group_by.test | 7 | ||||
-rw-r--r-- | sql/protocol.cc | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index a8766907fa5..b0c00a51722 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -702,3 +702,12 @@ c val-74 val-98 drop table t1,t2; +create table t1 (b int4 unsigned not null); +insert into t1 values(3000000000); +select * from t1; +b +3000000000 +select min(b) from t1; +min(b) +3000000000 +drop table t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 46e58cd00fd..fbd39019e6d 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -515,3 +515,10 @@ explain select c from t2 where a = 2 and b = 'val-2' group by c; select c from t2 where a = 2 and b = 'val-2' group by c; drop table t1,t2; +# Test for BUG#9298 "Wrong handling of int4 unsigned columns in GROUP functions" +# (the actual problem was with protocol code, not GROUP BY) +create table t1 (b int4 unsigned not null); +insert into t1 values(3000000000); +select * from t1; +select min(b) from t1; +drop table t1; diff --git a/sql/protocol.cc b/sql/protocol.cc index 773bbe697a3..485605ce8cd 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -810,7 +810,7 @@ bool Protocol_simple::store_long(longlong from) #endif char buff[20]; return net_store_data((char*) buff, - (uint) (int10_to_str((int) from,buff, -10)-buff)); + (uint) (int10_to_str((int)from,buff, (from <0)?-10:10)-buff)); } |