diff options
author | Gleb Shchepa <gleb.shchepa@oracle.com> | 2011-03-31 22:59:11 +0400 |
---|---|---|
committer | Gleb Shchepa <gleb.shchepa@oracle.com> | 2011-03-31 22:59:11 +0400 |
commit | 7aa81e2a02e78200eec105b968bda675af6f4987 (patch) | |
tree | f09c53960c31ba8a4695072c75182ac99ea0d4ba /mysql-test | |
parent | b8faa8f2c69a13c83d763f8d8605dcf3612c1257 (diff) | |
download | mariadb-git-7aa81e2a02e78200eec105b968bda675af6f4987.tar.gz |
Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
In the string context the MIN() and MAX() functions don't take
into account the unsignedness of the UNSIGNED BIGINT argument
column.
I.e.:
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (18446668621106209655);
SELECT CONCAT(MAX(a)) FROM t1;
returns -75452603341961.
mysql-test/r/func_group.result:
Test case for bug #11766094.
mysql-test/t/func_group.test:
Test case for bug #11766094.
sql/item.cc:
Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
The Item_cache_int::val_str() method has been modified to
take into account the unsigned_flag value when converting
data to string.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/func_group.result | 9 | ||||
-rw-r--r-- | mysql-test/t/func_group.test | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 1a21fb5872f..69bce1c8bd8 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1737,4 +1737,13 @@ SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b11111111111111111111111111111111 SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa'); # +# Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS +# +CREATE TABLE t1 (a BIGINT UNSIGNED); +INSERT INTO t1 VALUES (18446668621106209655); +SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1; +MAX(LENGTH(a)) LENGTH(MAX(a)) MIN(a) MAX(a) CONCAT(MIN(a)) CONCAT(MAX(a)) +20 20 18446668621106209655 18446668621106209655 18446668621106209655 18446668621106209655 +DROP TABLE t1; +# End of 5.1 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 8839a28b9dd..600b46fcde6 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1117,6 +1117,16 @@ SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa'); --enable_result_log + +--echo # +--echo # Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS +--echo # + +CREATE TABLE t1 (a BIGINT UNSIGNED); +INSERT INTO t1 VALUES (18446668621106209655); +SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1; +DROP TABLE t1; + --echo # --echo End of 5.1 tests |