From: Jorgen Loland Date: February 11 2011 3:41pm Subject: Re: bzr commit into mysql-5.5 branch (sergey.glukhov:3277) Bug#59685 List-Archive: http://lists.mysql.com/commits/131141 Message-Id: <4D555893.2090901@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Gluh, I think you're fixing a symptom rather than the problem in this bugfix. Please see my review email to Didrik for BUG#60085. I think there needs to be some coordination between these two bugs. On 02/07/2011 02:05 PM, Sergey Glukhov wrote: > #At file:///home/gluh/MySQL/mysql-5.5/ based on revid:anders.song@stripped > > 3277 Sergey Glukhov 2011-02-07 > Bug#59685 crash in String::length with date types > The crash happens because Item_cache which is result > holder for Item_subselect can't correctly convert > a DATETIME value from string to int representation. > The fix is to disable constant item convertion for > subselect(partial rollback of bug52157 fix). > @ mysql-test/r/type_date.result > test case > @ mysql-test/t/type_date.test > test case > @ sql/item_cmpfunc.cc > disable constant item convertion for subselects. > > modified: > mysql-test/r/type_date.result > mysql-test/t/type_date.test > sql/item_cmpfunc.cc > === modified file 'mysql-test/r/type_date.result' > --- a/mysql-test/r/type_date.result 2010-11-04 13:18:27 +0000 > +++ b/mysql-test/r/type_date.result 2011-02-07 13:05:20 +0000 > @@ -296,6 +296,18 @@ the_date the_time the_date the_time > 2010-01-01 01:01:01 2010-01-01 01:01:01 > DROP TABLE t1; > DROP VIEW v1; > +# > +# Bug#59685 crash in String::length with date types > +# > +CREATE TABLE t1(a DATE, b YEAR, KEY(a)); > +INSERT INTO t1 VALUES ('2011-01-01',2011); > +SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1; > +b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) > +0 > +SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1; > +b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) > +0 > +DROP TABLE t1; > End of 5.1 tests > # > # Bug #33629: last_day function can return null, but has 'not null' > > === modified file 'mysql-test/t/type_date.test' > --- a/mysql-test/t/type_date.test 2010-11-04 13:18:27 +0000 > +++ b/mysql-test/t/type_date.test 2011-02-07 13:05:20 +0000 > @@ -266,6 +266,18 @@ SELECT * FROM t1 JOIN v1 ON addtime( t1. > DROP TABLE t1; > DROP VIEW v1; > > +--echo # > +--echo # Bug#59685 crash in String::length with date types > +--echo # > + > +CREATE TABLE t1(a DATE, b YEAR, KEY(a)); > +INSERT INTO t1 VALUES ('2011-01-01',2011); > + > +SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1; > +SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1; > + > +DROP TABLE t1; > + > --echo End of 5.1 tests > > --echo # > > === modified file 'sql/item_cmpfunc.cc' > --- a/sql/item_cmpfunc.cc 2011-01-19 14:12:43 +0000 > +++ b/sql/item_cmpfunc.cc 2011-02-07 13:05:20 +0000 > @@ -403,7 +403,7 @@ static bool convert_constant_item(THD *t > Field *field= field_item->field; > int result= 0; > > - if ((*item)->const_item()) > + if (!(*item)->with_subselect&& (*item)->const_item()) > { > TABLE *table= field->table; > ulonglong orig_sql_mode= thd->variables.sql_mode; > > > > > -- Jørgen Løland | Senior Software Engineer | +47 73842138 Oracle MySQL Trondheim, Norway