From: Date: November 12 2007 4:52pm Subject: bk commit into 6.0 tree (gshchepa:1.2683) BUG#32262 List-Archive: http://lists.mysql.com/commits/37583 X-Bug: 32262 Message-Id: <20071112155406.455853D40D7@localhost.localdomain> Below is the list of changes that have just been committed into a local 6.0 repository of uchum. When uchum does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-11-12 19:52:48+04:00, gshchepa@stripped +3 -0 Fixed bug #32262: crash with decimal column. The server crashed on optimization of queries with a comparison of an indexed decimal column with a string value. mysql-test/r/range.result@stripped, 2007-11-12 19:47:15+04:00, gshchepa@stripped +14 -0 Added test case for bug #32262. mysql-test/t/range.test@stripped, 2007-11-12 19:47:04+04:00, gshchepa@stripped +10 -0 Added test case for bug #32262. sql/opt_range.cc@stripped, 2007-11-12 19:46:56+04:00, gshchepa@stripped +2 -0 Fixed bug #32262. The check_quick_select function has been changed to check input parameter for NULL value. diff -Nrup a/mysql-test/r/range.result b/mysql-test/r/range.result --- a/mysql-test/r/range.result 2007-06-28 03:31:22 +05:00 +++ b/mysql-test/r/range.result 2007-11-12 19:47:15 +04:00 @@ -1149,3 +1149,17 @@ explain select * from t2 where a=1000 an id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref a a 5 const 502 Using index condition drop table t1, t2; +End of 5.1 tests +CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1)); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT c1 FROM t1 WHERE c1 >= 'A' GROUP BY 1; +c1 +1 +2 +3 +Warnings: +Warning 1366 Incorrect decimal value: 'A' for column 'c1' at row 1 +Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DOUBLE value: 'A' +Warning 1292 Truncated incorrect DOUBLE value: 'A' +DROP TABLE t1; diff -Nrup a/mysql-test/t/range.test b/mysql-test/t/range.test --- a/mysql-test/t/range.test 2007-03-31 04:12:28 +05:00 +++ b/mysql-test/t/range.test 2007-11-12 19:47:04 +04:00 @@ -963,3 +963,13 @@ explain select * from t2 where a=1000 an drop table t1, t2; +--echo End of 5.1 tests + +# +# BUG#32262 fix: crash with decimal column... +# + +CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1)); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT c1 FROM t1 WHERE c1 >= 'A' GROUP BY 1; +DROP TABLE t1; diff -Nrup a/sql/opt_range.cc b/sql/opt_range.cc --- a/sql/opt_range.cc 2007-11-07 16:32:02 +04:00 +++ b/sql/opt_range.cc 2007-11-12 19:46:56 +04:00 @@ -7393,6 +7393,8 @@ ha_rows check_quick_select(PARAM *param, DBUG_ENTER("check_quick_select"); /* Handle cases when we don't have a valid non-empty list of range */ + if (!tree) + DBUG_RETURN(HA_POS_ERROR); if (tree->type == SEL_ARG::IMPOSSIBLE) DBUG_RETURN(0L); if (tree->type != SEL_ARG::KEY_RANGE || tree->part != 0)