summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-04-17 02:10:43 +0400
committerunknown <sergefp@mysql.com>2005-04-17 02:10:43 +0400
commit4a79aeb2074797487fc7ce9e288e73a1bed297ef (patch)
treee73a3d6c9b7401824ea8afb5bee602d37ca67084
parent4417d0ed3f9b42bc988ab678178b2ca1e034ec22 (diff)
parent1e52909a44a1f7137341f204b2c3f77a0d8f1c58 (diff)
downloadmariadb-git-4a79aeb2074797487fc7ce9e288e73a1bed297ef.tar.gz
Post-merge fixes
sql/opt_range.cc: Auto merged
-rw-r--r--mysql-test/r/range.result18
-rw-r--r--mysql-test/t/range.test20
-rw-r--r--sql/opt_range.cc1
3 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 049d6c0fd44..256c4ee6431 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -566,3 +566,21 @@ explain select * from t1 where a='aaa' collate latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where
drop table t1;
+CREATE TABLE t1 (
+`CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000',
+`ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '',
+`ARG2` char(3) character set latin1 collate latin1_bin NOT NULL default '',
+`FUNCTION` varchar(10) character set latin1 collate latin1_bin NOT NULL default '',
+`FUNCTINT` int(11) NOT NULL default '0',
+KEY `VERI_CLNT~2` (`ARG1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0),
+('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0),
+('001',' 3',' 0','Text 017',0);
+SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 1' OR ARG1 != ' 2');
+count(*)
+4
+SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 2' OR ARG1 != ' 1');
+count(*)
+4
+drop table t1;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 38ed665bdf1..84ae9674de9 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -433,3 +433,23 @@ explain select * from t1 where a='aaa' collate latin1_bin;
# this one cannot:
explain select * from t1 where a='aaa' collate latin1_german1_ci;
drop table t1;
+
+# Test for BUG#9348 "result for WHERE A AND (B OR C) differs from WHERE a AND (C OR B)"
+CREATE TABLE t1 (
+ `CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000',
+ `ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '',
+ `ARG2` char(3) character set latin1 collate latin1_bin NOT NULL default '',
+ `FUNCTION` varchar(10) character set latin1 collate latin1_bin NOT NULL default '',
+ `FUNCTINT` int(11) NOT NULL default '0',
+ KEY `VERI_CLNT~2` (`ARG1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0),
+ ('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0),
+ ('001',' 3',' 0','Text 017',0);
+
+SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 1' OR ARG1 != ' 2');
+
+SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 2' OR ARG1 != ' 1');
+drop table t1;
+
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 9920d89519e..2ced24f87bb 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -4371,6 +4371,7 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
last=last->next;
key1=key1->tree_delete(save);
}
+ last->copy_min(tmp);
if (last->copy_min(key2) || last->copy_max(key2))
{ // Full range
key1->free_tree();