MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:bar Date:June 22 2007 12:18pm
Subject:bk commit into 5.0 tree (bar:1.2516) BUG#28925
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bar. When bar 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@stripped, 2007-06-22 17:18:40+05:00, bar@stripped +6 -0
  Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
  Problem: separator was not converted to the result character set,
  so the result was a mixture of two different character sets,
  which was especially bad for UCS2.
  Fix: convert separator to the result character set.

  mysql-test/r/ctype_ucs.result@stripped, 2007-06-22 17:18:38+05:00, bar@stripped +21 -0
    Adding test case

  mysql-test/r/ctype_ucs2_def.result@stripped, 2007-06-22 17:18:38+05:00, bar@stripped +8 -0
    Adding test case

  mysql-test/t/ctype_ucs.test@stripped, 2007-06-22 17:18:38+05:00, bar@stripped +18 -0
    Adding test case

  mysql-test/t/ctype_ucs2_def.test@stripped, 2007-06-22 17:18:38+05:00, bar@stripped +13 -0
    Adding test case

  sql/item_sum.cc@stripped, 2007-06-22 17:18:38+05:00, bar@stripped +21 -0
    Adding conversion of separator to the result character set

  sql/sql_yacc.yy@stripped, 2007-06-22 17:18:38+05:00, bar@stripped +5 -2
    Fixing GROUPC_CONCAT problems when "mysqld --default-character-set=ucs2".

# 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:	bar
# Host:	bar.myoffice.izhnet.ru
# Root:	/home/bar/mysql-work/mysql-5.0.b28925

--- 1.208/sql/item_sum.cc	2007-05-22 17:45:56 +05:00
+++ 1.209/sql/item_sum.cc	2007-06-22 17:18:38 +05:00
@@ -3209,6 +3209,27 @@ Item_func_group_concat::fix_fields(THD *
   null_value= 1;
   max_length= thd->variables.group_concat_max_len;
 
+  uint32 offset;
+  if (separator->needs_conversion(separator->length(), separator->charset(),
+                                  collation.collation, &offset))
+  {
+    uint32 buflen= collation.collation->mbmaxlen * separator->length();
+    uint errors, conv_length;
+    char *buf;
+    String *new_separator;
+
+    if (!(buf= thd->stmt_arena->alloc(buflen)) ||
+        !(new_separator= new(thd->stmt_arena->mem_root)
+                           String(buf, buflen, collation.collation)))
+      return TRUE;
+    
+    conv_length= copy_and_convert(buf, buflen, collation.collation,
+                                  separator->ptr(), separator->length(),
+                                  separator->charset(), &errors);
+    new_separator->length(conv_length);
+    separator= new_separator;
+  }
+
   if (check_sum_func(thd, ref))
     return TRUE;
 

--- 1.521/sql/sql_yacc.yy	2007-06-03 12:03:14 +05:00
+++ 1.522/sql/sql_yacc.yy	2007-06-22 17:18:38 +05:00
@@ -5420,8 +5420,11 @@ opt_distinct:
     |DISTINCT   { $$ = 1; };
 
 opt_gconcat_separator:
-    /* empty */        { $$ = new (YYTHD->mem_root) String(",",1,default_charset_info); }
-    |SEPARATOR_SYM text_string  { $$ = $2; };
+    /* empty */
+      {
+        $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1);
+      }
+    | SEPARATOR_SYM text_string { $$ = $2; };
 
 
 opt_gorder_clause:

--- 1.51/mysql-test/r/ctype_ucs.result	2007-03-28 18:57:27 +05:00
+++ 1.52/mysql-test/r/ctype_ucs.result	2007-06-22 17:18:38 +05:00
@@ -865,4 +865,25 @@ blob	65535	65535
 text	65535	65535
 text	65535	32767
 drop table t1;
+create table t1 (a char(1) character set ucs2);
+insert into t1 values ('a'),('b'),('c');
+select hex(group_concat(a)) from t1;
+hex(group_concat(a))
+0061002C0062002C0063
+select collation(group_concat(a)) from t1;
+collation(group_concat(a))
+ucs2_general_ci
+drop table t1;
+set names latin1;
+create table t1 (a char(1) character set latin1);
+insert into t1 values ('a'),('b'),('c');
+set character_set_connection=ucs2;
+select hex(group_concat(a separator ',')) from t1;
+hex(group_concat(a separator ','))
+612C622C63
+select collation(group_concat(a separator ',')) from t1;
+collation(group_concat(a separator ','))
+latin1_swedish_ci
+drop table t1;
+set names latin1;
 End of 5.0 tests

--- 1.50/mysql-test/t/ctype_ucs.test	2007-03-28 18:57:27 +05:00
+++ 1.51/mysql-test/t/ctype_ucs.test	2007-06-22 17:18:38 +05:00
@@ -594,4 +594,22 @@ select data_type, character_octet_length
   from information_schema.columns where table_name='t1';
 drop table t1;
 
+#
+# Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
+#
+create table t1 (a char(1) character set ucs2);
+insert into t1 values ('a'),('b'),('c');
+select hex(group_concat(a)) from t1;
+select collation(group_concat(a)) from t1;
+drop table t1;
+
+set names latin1;
+create table t1 (a char(1) character set latin1);
+insert into t1 values ('a'),('b'),('c');
+set character_set_connection=ucs2;
+select hex(group_concat(a separator ',')) from t1;
+select collation(group_concat(a separator ',')) from t1;
+drop table t1;
+set names latin1;
+
 --echo End of 5.0 tests

--- 1.3/mysql-test/r/ctype_ucs2_def.result	2006-08-21 19:10:39 +05:00
+++ 1.4/mysql-test/r/ctype_ucs2_def.result	2007-06-22 17:18:38 +05:00
@@ -7,3 +7,11 @@ character_set_server	ucs2
 DROP TABLE IF EXISTS t1;
 create table t1 (a int);
 drop table t1;
+End of 4.1 tests
+create table t1 (a char(1) character set latin1);
+insert into t1 values ('a'),('b'),('c');
+select hex(group_concat(a)) from t1;
+hex(group_concat(a))
+612C622C63
+drop table t1;
+End of 5.0 tests

--- 1.4/mysql-test/t/ctype_ucs2_def.test	2007-02-19 14:57:02 +04:00
+++ 1.5/mysql-test/t/ctype_ucs2_def.test	2007-06-22 17:18:38 +05:00
@@ -14,3 +14,16 @@ DROP TABLE IF EXISTS t1;
 --enable_warnings
 create table t1 (a int);
 drop table t1;
+
+--echo End of 4.1 tests
+
+#
+# Bug #28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
+# Check that GROUP_CONCAT works fine with --default-character-set=ucs2
+#
+create table t1 (a char(1) character set latin1);
+insert into t1 values ('a'),('b'),('c');
+select hex(group_concat(a)) from t1;
+drop table t1;
+
+--echo End of 5.0 tests
Thread
bk commit into 5.0 tree (bar:1.2516) BUG#28925bar22 Jun
  • Re: bk commit into 5.0 tree (bar:1.2516) BUG#28925Konstantin Osipov22 Jun