Didrik,
Great work. Approved. (There is one small comment inline)
On 02/15/2011 11:27 AM, Tor Didriksen wrote:
> #At file:///export/home/didrik/repo/5.5-foo/ based on
> revid:joerg@stripped
>
> 3326 Tor Didriksen 2011-02-15
> Bug #11766860 - 60085: CRASH IN ITEM::SAVE_IN_FIELD() WITH TIME DATA TYPE
>
> This assumption in Item_cache_datetime::cache_value_int
> was wrong:
> - /* Assume here that the underlying item will do correct conversion.*/
> - int_value= example->val_int_result();
> @ mysql-test/r/subselect_innodb.result
> New test case.
> @ mysql-test/t/subselect_innodb.test
> New test case.
> @ sql/item.cc
> In Item_cache_datetime::cache_value_int()
> - call get_time() or get_date() depending on desired type
> - convert the returned MYSQL_TIME value to longlong depending on desired
> type
> @ sql/item.h
> The cached int_value in Item_cache_datetime should not be unsigned:
> - it is used mostly in signed context
> - it can actually have negative value (for TIME data type)
> @ sql/item_subselect.cc
> Add some DBUG_TRACE for easier bug-hunting.
>
> modified:
> mysql-test/r/subselect_innodb.result
> mysql-test/t/subselect_innodb.test
> sql/item.cc
> sql/item.h
> sql/item_subselect.cc
> === modified file 'mysql-test/r/subselect_innodb.result'
> --- a/mysql-test/r/subselect_innodb.result 2006-01-26 16:54:34 +0000
> +++ b/mysql-test/r/subselect_innodb.result 2011-02-15 10:27:30 +0000
> @@ -245,3 +245,12 @@ x
> NULL
> drop procedure p1;
> drop tables t1,t2,t3;
> +#
> +# Bug#60085 crash in Item::save_in_field() with time data type
> +#
> +CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
> +INSERT INTO t1 VALUES ('2011-05-13', 0);
> +SELECT 1 FROM t1 WHERE b< (SELECT CAST(a as date) FROM t1 GROUP BY a);
> +1
> +1
I suggest "SELECT *" here
--
Jørgen Løland | Senior Software Engineer | +47 73842138
Oracle MySQL
Trondheim, Norway