LGTM
-- didrik
On Thu, Mar 31, 2011 at 8:59 PM, Gleb Shchepa <gleb.shchepa@stripped>wrote:
> #At file:///mnt/sda7/work/bug11766094-5.1/ based on
> revid:magne.mahre@stripped
>
> 3645 Gleb Shchepa 2011-03-31
> 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.
>
> modified:
> mysql-test/r/func_group.result
> mysql-test/t/func_group.test
> sql/item.cc
> === modified file 'mysql-test/r/func_group.result'
> --- a/mysql-test/r/func_group.result 2010-12-21 12:30:07 +0000
> +++ b/mysql-test/r/func_group.result 2011-03-31 18:59:11 +0000
> @@ -1737,4 +1737,13 @@ SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',
> 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
>
> === modified file 'mysql-test/t/func_group.test'
> --- a/mysql-test/t/func_group.test 2010-12-21 12:30:07 +0000
> +++ b/mysql-test/t/func_group.test 2011-03-31 18:59:11 +0000
> @@ -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
>
>
> === modified file 'sql/item.cc'
> --- a/sql/item.cc 2011-03-30 07:08:35 +0000
> +++ b/sql/item.cc 2011-03-31 18:59:11 +0000
> @@ -7109,7 +7109,7 @@ String *Item_cache_int::val_str(String *
> DBUG_ASSERT(fixed == 1);
> if (!value_cached && !cache_value())
> return NULL;
> - str->set(value, default_charset());
> + str->set_int(value, unsigned_flag, default_charset());
> return str;
> }
>
>
>
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:
> http://lists.mysql.com/commits?unsub=1
>