From: Date: July 16 2005 5:19pm Subject: bk commit into 5.0 tree (igor:1.1949) BUG#11853 List-Archive: http://lists.mysql.com/internals/27218 X-Bug: 11853 Message-Id: <20050716151931.7F104175C5D@rurik.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of igor. When igor 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.1949 05/07/16 08:19:20 igor@stripped +3 -0 opt_range.cc: Fixed bug #11853. Corrected the code of the range optimization for NOT IN and NOT BETWEEN. range.test, range.result: Fixed bug #11853. sql/opt_range.cc 1.182 05/07/16 08:15:20 igor@stripped +2 -1 Fixed bug #11853. Corrected the code of the range optimization for NOT IN and NOT BETWEEN. mysql-test/r/range.result 1.39 05/07/16 08:14:32 igor@stripped +24 -0 mysql-test/t/range.test 1.31 05/07/16 08:14:04 igor@stripped +23 -0 Fixed bug #11853. # 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: igor # Host: rurik.mysql.com # Root: /home/igor/dev/mysql-5.0-0 --- 1.181/sql/opt_range.cc Sun Jul 3 17:44:31 2005 +++ 1.182/sql/opt_range.cc Sat Jul 16 08:15:20 2005 @@ -3531,7 +3531,8 @@ if (arg->type() != Item::FUNC_ITEM) DBUG_RETURN(0); cond_func= (Item_func*) arg; - if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE) + if (cond_func->functype() != Item_func::BETWEEN && + cond_func->functype() != Item_func::IN_FUNC) DBUG_RETURN(0); inv= TRUE; } --- 1.38/mysql-test/r/range.result Tue Jun 28 07:24:19 2005 +++ 1.39/mysql-test/r/range.result Sat Jul 16 08:14:32 2005 @@ -744,3 +744,27 @@ 1 3 DROP VIEW v1; DROP TABLE t1; +CREATE TABLE t1 (name varchar(15) NOT NULL, KEY idx(name)); +INSERT INTO t1 VALUES ('Betty'), ('Anna'); +SELECT * FROM t1; +name +Anna +Betty +DELETE FROM t1 WHERE name NOT LIKE 'A%a'; +SELECT * FROM t1; +name +Anna +DROP TABLE t1; +CREATE TABLE t1 (a int, KEY idx(a)); +INSERT INTO t1 VALUES (NULL), (1), (2), (3); +SELECT * FROM t1; +a +NULL +1 +2 +3 +DELETE FROM t1 WHERE NOT(a <=> 2); +SELECT * FROM t1; +a +2 +DROP TABLE t1; --- 1.30/mysql-test/t/range.test Tue Jun 28 07:23:43 2005 +++ 1.31/mysql-test/t/range.test Sat Jul 16 08:14:04 2005 @@ -553,3 +553,26 @@ DROP VIEW v1; DROP TABLE t1; + +# +# Bug #11853: DELETE statement with a NOT (LIKE/<=>) where condition +# for an indexed attribute +# + +CREATE TABLE t1 (name varchar(15) NOT NULL, KEY idx(name)); +INSERT INTO t1 VALUES ('Betty'), ('Anna'); + +SELECT * FROM t1; +DELETE FROM t1 WHERE name NOT LIKE 'A%a'; +SELECT * FROM t1; + +DROP TABLE t1; + +CREATE TABLE t1 (a int, KEY idx(a)); +INSERT INTO t1 VALUES (NULL), (1), (2), (3); + +SELECT * FROM t1; +DELETE FROM t1 WHERE NOT(a <=> 2); +SELECT * FROM t1; + +DROP TABLE t1;