diff options
-rw-r--r-- | mysql-test/r/func_str.result | 23 | ||||
-rw-r--r-- | mysql-test/t/func_str.test | 27 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 1 |
3 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 0db62b133e7..58d66c7f712 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -703,3 +703,26 @@ NULL select trim('xyz' from null) as "must_be_null"; must_be_null NULL +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +a bigint(20) unsigned default NULL, +PRIMARY KEY (id) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('0','16307858876001849059'); +SELECT CONV('e251273eb74a8ee3', 16, 10); +CONV('e251273eb74a8ee3', 16, 10) +16307858876001849059 +EXPLAIN +SELECT id +FROM t1 +WHERE a = 16307858876001849059; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +EXPLAIN +SELECT id +FROM t1 +WHERE a = CONV('e251273eb74a8ee3', 16, 10); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +DROP TABLE t1; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index a5d95332caa..34bbb2bab0f 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -443,3 +443,30 @@ select quote(trim(concat(' ', 'a'))); # select trim(null from 'kate') as "must_be_null"; select trim('xyz' from null) as "must_be_null"; + +# +# Bug #7751 - conversion for a bigint unsigned constant +# + +CREATE TABLE t1 ( + id int(11) NOT NULL auto_increment, + a bigint(20) unsigned default NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES +('0','16307858876001849059'); + +SELECT CONV('e251273eb74a8ee3', 16, 10); + +EXPLAIN +SELECT id + FROM t1 + WHERE a = 16307858876001849059; + +EXPLAIN + SELECT id + FROM t1 + WHERE a = CONV('e251273eb74a8ee3', 16, 10); + +DROP TABLE t1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index cd98fb62818..cee3316886a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2171,6 +2171,7 @@ String *Item_func_conv::val_str(String *str) return 0; } null_value=0; + unsigned_flag= !(from_base < 0); if (from_base < 0) dec= my_strntoll(res->charset(),res->ptr(),res->length(),-from_base,&endptr,&err); else |