List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:November 5 2009 2:42pm
Subject:bzr commit into mysql-5.5-next-mr branch (mikael:2924) Bug#6045 Bug#47774
Bug#48161 Bug#48447
View as plain text  
#At file:///home/mikael/mysql_clones/mysql-next-mr-bug48161/ based on revid:mikael@stripped

 2924 Mikael Ronstrom	2009-11-05
      BUG#48447, BUG#48161, fixed a regression from fix of BUG#6045, where binary collations can use indexes/partition pruning for cases using equality conditions, however it cannot be used for any other condition like <, >, <=, >=, <>, also added test case for verification of BUG#47774 in this patch

    modified:
      mysql-test/r/partition_column.result
      mysql-test/r/partition_innodb.result
      mysql-test/t/partition_column.test
      mysql-test/t/partition_innodb.test
      sql/opt_range.cc
=== modified file 'mysql-test/r/partition_column.result'
--- a/mysql-test/r/partition_column.result	2009-11-02 13:49:26 +0000
+++ b/mysql-test/r/partition_column.result	2009-11-05 14:42:03 +0000
@@ -1,4 +1,69 @@
 drop table if exists t1;
+create table t1 (a varchar(1) character set latin1 collate latin1_general_ci);
+insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
+select * from t1 where a > 'B' collate latin1_bin;
+a
+a
+b
+C
+c
+select * from t1 where a <> 'B' collate latin1_bin;
+a
+A
+a
+b
+C
+c
+create index i on t1 (a);
+select * from t1 where a > 'B' collate latin1_bin;
+a
+a
+b
+C
+c
+select * from t1 where a <> 'B' collate latin1_bin;
+a
+A
+a
+b
+C
+c
+drop index i on t1;
+alter table t1
+partition by range columns(a)
+( partition p0 values less than ('a'),
+partition p1 values less than ('b'),
+partition p2 values less than ('c'),
+partition p3 values less than ('d'));
+select * from t1 where a > 'B' collate latin1_bin;
+a
+a
+b
+C
+c
+select * from t1 where a <> 'B' collate latin1_bin;
+a
+A
+a
+b
+C
+c
+drop table t1;
+create table t1 (a varchar(2) character set latin1,
+b varchar(2) character set latin1)
+partition by list columns(a,b)
+(partition p0 values in (('a','a')));
+insert into t1 values ('A','A');
+select * from t1 where b <> 'a' collate latin1_bin AND
+a = 'A' collate latin1_bin;
+a	b
+A	A
+alter table t1 remove partitioning;
+select * from t1 where b <> 'a' collate latin1_bin AND
+a = 'A' collate latin1_bin;
+a	b
+A	A
+drop table t1;
 create table t1 (a varchar(5))
 partition by list columns(a)
 ( partition p0 values in ('\''),

=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result	2009-10-29 17:04:23 +0000
+++ b/mysql-test/r/partition_innodb.result	2009-11-05 14:42:03 +0000
@@ -1,4 +1,15 @@
 drop table if exists t1;
+create table t1 (a varchar(5), b int signed, c varchar(10), d datetime)
+partition by range columns(b,c)
+subpartition by hash(to_seconds(d))
+( partition p0 values less than (2, 'b'),
+partition p1 values less than (4, 'd'),
+partition p2 values less than (10, 'za'));
+insert into t1 values ('a', 3, 'w', '2001-10-27 04:34:00');
+insert into t1 values ('r', 7, 'w', '2001-10-27 05:34:00');
+insert into t1 values ('g', 10, 'w', '2001-10-27 06:34:00');
+update t1 set a = 'c' where a > 'f';
+drop table t1;
 create table t1 (a varchar(5))
 engine=memory
 partition by range columns(a)

=== modified file 'mysql-test/t/partition_column.test'
--- a/mysql-test/t/partition_column.test	2009-11-02 13:49:26 +0000
+++ b/mysql-test/t/partition_column.test	2009-11-05 14:42:03 +0000
@@ -8,6 +8,41 @@
 drop table if exists t1;
 --enable_warnings
 
+#
+# BUG#48161, Delivering too few records using collate syntax with partitions
+# BUG#48447, Delivering too few records with indexes using collate syntax
+#
+# Test case from BUG#48447 with some extension
+create table t1 (a varchar(1) character set latin1 collate latin1_general_ci);
+insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
+select * from t1 where a > 'B' collate latin1_bin;
+select * from t1 where a <> 'B' collate latin1_bin;
+create index i on t1 (a);
+select * from t1 where a > 'B' collate latin1_bin;
+select * from t1 where a <> 'B' collate latin1_bin;
+drop index i on t1;
+alter table t1
+partition by range columns(a)
+( partition p0 values less than ('a'),
+  partition p1 values less than ('b'),
+  partition p2 values less than ('c'),
+  partition p3 values less than ('d'));
+select * from t1 where a > 'B' collate latin1_bin;
+select * from t1 where a <> 'B' collate latin1_bin;
+drop table t1;
+# Test case from BUG#48161
+create table t1 (a varchar(2) character set latin1,
+                 b varchar(2) character set latin1)
+partition by list columns(a,b)
+(partition p0 values in (('a','a')));
+insert into t1 values ('A','A');
+select * from t1 where b <> 'a' collate latin1_bin AND
+                       a = 'A' collate latin1_bin;
+alter table t1 remove partitioning;
+select * from t1 where b <> 'a' collate latin1_bin AND
+                       a = 'A' collate latin1_bin;
+drop table t1;
+
 create table t1 (a varchar(5))
 partition by list columns(a)
 ( partition p0 values in ('\''),

=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test	2009-10-29 17:04:23 +0000
+++ b/mysql-test/t/partition_innodb.test	2009-11-05 14:42:03 +0000
@@ -6,6 +6,21 @@ drop table if exists t1;
 --enable_warnings
 
 #
+# BUG#47774, Assertion failure in InnoDB using column list partitioning
+#
+create table t1 (a varchar(5), b int signed, c varchar(10), d datetime)
+partition by range columns(b,c)
+subpartition by hash(to_seconds(d))
+( partition p0 values less than (2, 'b'),
+  partition p1 values less than (4, 'd'),
+  partition p2 values less than (10, 'za'));
+insert into t1 values ('a', 3, 'w', '2001-10-27 04:34:00');
+insert into t1 values ('r', 7, 'w', '2001-10-27 05:34:00');
+insert into t1 values ('g', 10, 'w', '2001-10-27 06:34:00');
+update t1 set a = 'c' where a > 'f';
+drop table t1;
+
+#
 # BUG#47776, Failed to update for MEMORY engine, crash for InnoDB and success for MyISAM
 #
 create table t1 (a varchar(5))

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2009-10-29 17:04:23 +0000
+++ b/sql/opt_range.cc	2009-11-05 14:42:03 +0000
@@ -5882,7 +5882,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND
       value->result_type() == STRING_RESULT &&
       key_part->image_type == Field::itRAW &&
       ((Field_str*)field)->charset() != conf_func->compare_collation() &&
-      !(conf_func->compare_collation()->state & MY_CS_BINSORT))
+      !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
+        (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC)))
     goto end;
 
   if (param->using_real_indexes)


Attachment: [text/bzr-bundle] bzr/mikael@mysql.com-20091105144203-5qiv3n9qk542c1sh.bundle
Thread
bzr commit into mysql-5.5-next-mr branch (mikael:2924) Bug#6045 Bug#47774Bug#48161 Bug#48447Mikael Ronstrom5 Nov