List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:October 22 2009 4:18pm
Subject:bzr commit into mysql-5.5.0-trunk branch (mikael:2898) Bug#46183
View as plain text  
#At file:///home/mikael/mysql_clones/mysql-trunk-wl3352-values/

 2898 Mikael Ronstrom	2009-10-22
      BUG#46183, added character set identifier on character constants in VALUES part for column list partitioned tables to ensure constants are handled properly according to character sets
      modified:
        mysql-test/r/partition_column.result
        mysql-test/t/partition_column.test
        sql/sql_partition.cc

=== modified file 'mysql-test/r/partition_column.result'
--- a/mysql-test/r/partition_column.result	2009-10-22 14:15:06 +0000
+++ b/mysql-test/r/partition_column.result	2009-10-22 16:17:59 +0000
@@ -1,4 +1,19 @@
 drop table if exists t1;
+create table t1 (a varchar(2) character set ucs2)
+partition by list column_list (a)
+(partition p0 values in (0x2020),
+partition p1 values in (''));
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST  COLUMN_LIST(a)
+(PARTITION p0 VALUES IN (_ucs2'  ') ENGINE = MyISAM,
+ PARTITION p1 VALUES IN (_ucs2'') ENGINE = MyISAM) */
+insert into t1 values ('');
+insert into t1 values (_ucs2 0x2020);
+drop table t1;
 create table t1 (a int, b char(10), c varchar(25), d datetime)
 partition by range column_list(a,b,c,d)
 subpartition by hash (to_seconds(d))
@@ -26,6 +41,21 @@ RANGE COLUMN_LIST	a,b,c,d	1,MAXVALUE,MAX
 RANGE COLUMN_LIST	a,b,c,d	1,MAXVALUE,MAXVALUE,MAXVALUE
 RANGE COLUMN_LIST	a,b,c,d	1,MAXVALUE,MAXVALUE,MAXVALUE
 RANGE COLUMN_LIST	a,b,c,d	1,MAXVALUE,MAXVALUE,MAXVALUE
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(10) DEFAULT NULL,
+  `c` varchar(25) DEFAULT NULL,
+  `d` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE  COLUMN_LIST(a,b,c,d)
+SUBPARTITION BY HASH (to_seconds(d))
+SUBPARTITIONS 4
+(PARTITION p0 VALUES LESS THAN (1,_latin1'0',MAXVALUE,0) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (1,_latin1'a',MAXVALUE,730120) ENGINE = MyISAM,
+ PARTITION p2 VALUES LESS THAN (1,_latin1'a',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
+ PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) */
 drop table t1;
 create table t1 (a int, b int)
 partition by range column_list (a,b)
@@ -243,10 +273,10 @@ t1	CREATE TABLE `t1` (
 /*!50100 PARTITION BY RANGE  COLUMN_LIST(a,b,c)
 SUBPARTITION BY KEY (c,d)
 SUBPARTITIONS 3
-(PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM,
- PARTITION p2 VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM,
- PARTITION p3 VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM) */
+(PARTITION p0 VALUES LESS THAN (1,_latin1'abc',_latin1'abc') ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (2,_latin1'abc',_latin1'abc') ENGINE = MyISAM,
+ PARTITION p2 VALUES LESS THAN (3,_latin1'abc',_latin1'abc') ENGINE = MyISAM,
+ PARTITION p3 VALUES LESS THAN (4,_latin1'abc',_latin1'abc') ENGINE = MyISAM) */
 insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
 insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3);
 insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3);
@@ -274,8 +304,8 @@ t1	CREATE TABLE `t1` (
   `c` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 /*!50100 PARTITION BY RANGE  COLUMN_LIST(a,b,c)
-(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) */
+(PARTITION p0 VALUES LESS THAN (1,_latin1'A',1) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (1,_latin1'B',1) ENGINE = MyISAM) */
 insert into t1 values (1, 'A', 1);
 explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra

=== modified file 'mysql-test/t/partition_column.test'
--- a/mysql-test/t/partition_column.test	2009-10-22 14:15:06 +0000
+++ b/mysql-test/t/partition_column.test	2009-10-22 16:17:59 +0000
@@ -8,6 +8,18 @@
 drop table if exists t1;
 --enable_warnings
 
+#
+# BUG#48163, Dagger in UCS2 not working as partition value
+#
+create table t1 (a varchar(2) character set ucs2)
+partition by list column_list (a)
+(partition p0 values in (0x2020),
+ partition p1 values in (''));
+show create table t1;
+insert into t1 values ('');
+insert into t1 values (_ucs2 0x2020);
+drop table t1;
+
 create table t1 (a int, b char(10), c varchar(25), d datetime)
 partition by range column_list(a,b,c,d)
 subpartition by hash (to_seconds(d))
@@ -18,19 +30,9 @@ subpartitions 4
   partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
 select partition_method, partition_expression, partition_description
   from information_schema.partitions where table_name = "t1";
-#show create table t1;
+show create table t1;
 drop table t1;
 
-#
-# BUG#48163, Dagger in UCS2 not working as partition value
-#
-#create table t1 (a varchar(2) character set ucs2)
-#partition by list column_list (a)
-#(partition p0 values in (0x2020),
-# partition p1 values in (''));
-#insert into t1 values ('');
-#drop table t1;
-
 --error ER_NULL_IN_VALUES_LESS_THAN
 create table t1 (a int, b int)
 partition by range column_list (a,b)

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-10-22 14:15:06 +0000
+++ b/sql/sql_partition.cc	2009-10-22 16:17:59 +0000
@@ -2147,7 +2147,14 @@ static int add_column_list_values(File f
           return 1;
         }
         if (item_expr->result_type() == STRING_RESULT)
+        {
+          if (field_cs)
+          {
+            err+= add_string(fptr,"_");
+            err+= add_string(fptr, field_cs->csname);
+          }
           err+= add_string(fptr,"'");
+        }
         err+= add_string_object(fptr, res);
         if (item_expr->result_type() == STRING_RESULT)
           err+= add_string(fptr,"'");

Thread
bzr commit into mysql-5.5.0-trunk branch (mikael:2898) Bug#46183Mikael Ronstrom22 Oct