From: Date: July 16 2005 9:30am Subject: bk commit into 4.1 tree (timour:1.2365) BUG#11185 List-Archive: http://lists.mysql.com/internals/27211 X-Bug: 11185 Message-Id: <20050716073031.4C2881BDE82@zmei.home> Below is the list of changes that have just been committed into a local 4.1 repository of timka. When timka 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 1.2365 05/07/16 10:30:25 timour@stripped +2 -0 Added test for Bug #11521 "Negative integer keys incorrectly substituted for 0 during range analysis." The problem is that the range optimizer incorrectly replaces any negative constant with '0' for all types except BIGINT because the method save_in_field() casts negative integers to non-negative. This causes incorrect query results where (0 = any_negative_number). The problem caused by this bug is fixed by the patch for BUG#11185. That patch constitutes an optimization due to which the problem code is never called with negative constants. This patch adds a test so we are sure that the problem does not reappear. mysql-test/t/select.test 1.43 05/07/16 10:29:57 timour@stripped +11 -0 Test for BUG#11521. mysql-test/r/select.result 1.60 05/07/16 10:29:57 timour@stripped +12 -0 Test for BUG#11521. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: timour # Host: zmei.home # Root: /home/timka/mysql/src/4.1-dbg --- 1.59/mysql-test/r/select.result 2005-07-16 02:25:22 +03:00 +++ 1.60/mysql-test/r/select.result 2005-07-16 10:29:57 +03:00 @@ -2570,3 +2570,15 @@ 1 NULL drop table t1,t2; +create table t2 (a tinyint unsigned); +create index t2i on t2(a); +insert into t2 values (0), (254), (255); +explain select * from t2 where a > -1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 index t2i t2i 2 NULL 3 Using where; Using index +select * from t2 where a > -1; +a +0 +254 +255 +drop table t2; --- 1.42/mysql-test/t/select.test 2005-07-16 02:24:32 +03:00 +++ 1.43/mysql-test/t/select.test 2005-07-16 10:29:57 +03:00 @@ -2127,3 +2127,14 @@ select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3) from t2 C where A.f4 = C.f4) or A.f3 IS NULL; drop table t1,t2; + +# +# Bug #11521 Negative integer keys incorrectly substituted for 0 during +# range analysis. + +create table t2 (a tinyint unsigned); +create index t2i on t2(a); +insert into t2 values (0), (254), (255); +explain select * from t2 where a > -1; +select * from t2 where a > -1; +drop table t2;