List:Internals« Previous MessageNext Message »
From:igor Date:September 7 2005 7:20am
Subject:bk commit into 4.1 tree (igor:1.2407) BUG#12863
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2407 05/09/06 22:20:11 igor@stripped +4 -0
  func_gconcat.result, func_gconcat.test:
    Added test cases for bug #12863.
  item_sum.cc, item_sum.h:
    Fixed bug #12863.
    Added a flag to Item_func_group_concat set to FALSE after
    concatenation of the first element of a group.

  mysql-test/r/func_gconcat.result
    1.41 05/09/06 22:14:39 igor@stripped +20 -0
    Added test cases for bug #12863.

  mysql-test/t/func_gconcat.test
    1.33 05/09/06 22:14:08 igor@stripped +16 -0
    Added test cases for bug #12863.

  sql/item_sum.cc
    1.144 05/09/06 22:13:10 igor@stripped +5 -3
    Fixed bug #12863.
    Added a flag to Item_func_group_concat set to FALSE after
    concatenation of the first element of a group.

  sql/item_sum.h
    1.81 05/09/06 22:03:08 igor@stripped +1 -0
    Fixed bug #12863.
    Added a flag to Item_func_group_concat set to FALSE after
    concatenation of the first element of a group.

# 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-4.1-0

--- 1.143/sql/item_sum.cc	Wed Aug 31 07:12:23 2005
+++ 1.144/sql/item_sum.cc	Tue Sep  6 22:13:10 2005
@@ -1664,7 +1664,9 @@
   char buff[MAX_FIELD_WIDTH];
   String tmp((char *)&buff,sizeof(buff),default_charset_info), tmp2;
 
-  if (item->result.length())
+  if (item->no_appended)
+    item->no_appended= FALSE;
+  else
     item->result.append(*item->separator);
 
   tmp.length(0);
@@ -1856,6 +1858,7 @@
   result.copy();
   null_value= TRUE;
   warning_for_row= FALSE;
+  no_appended= TRUE;
   if (tree_mode)
     reset_tree(tree);
 }
@@ -1898,8 +1901,7 @@
 
 void Item_func_group_concat::reset_field()
 {
-  if (tree_mode)
-    reset_tree(tree);
+  DBUG_ASSERT(0);
 }
 
 

--- 1.80/sql/item_sum.h	Mon May  9 02:33:15 2005
+++ 1.81/sql/item_sum.h	Tue Sep  6 22:03:08 2005
@@ -709,6 +709,7 @@
   uint arg_count_field;
   uint field_list_offset;
   uint count_cut_values;
+  bool no_appended;
   /*
     Following is 0 normal object and pointer to original one for copy 
     (to correctly free resources)

--- 1.40/mysql-test/r/func_gconcat.result	Mon Sep  5 06:55:48 2005
+++ 1.41/mysql-test/r/func_gconcat.result	Tue Sep  6 22:14:39 2005
@@ -560,3 +560,23 @@
 NULL
 1
 drop table t1;
+CREATE TABLE t1 (id int, a varchar(9));
+INSERT INTO t1 VALUES
+(2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, '');
+SELECT GROUP_CONCAT(a) FROM t1;
+GROUP_CONCAT(a)
+,,x,y,z,
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
+GROUP_CONCAT(a ORDER BY a)
+,,,x,y,z
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id;
+GROUP_CONCAT(a)
+,y
+,x
+z,
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
+GROUP_CONCAT(a ORDER BY a)
+,y
+,x
+,z
+DROP TABLE t1;

--- 1.32/mysql-test/t/func_gconcat.test	Mon Sep  5 06:56:26 2005
+++ 1.33/mysql-test/t/func_gconcat.test	Tue Sep  6 22:14:08 2005
@@ -356,4 +356,20 @@
 select group_concat('x') UNION ALL select 1;
 drop table t1;
 
+#
+# Bug #12863 : missing separators after first empty cancatanated elements
+#
+
+CREATE TABLE t1 (id int, a varchar(9));
+INSERT INTO t1 VALUES
+  (2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, '');
+
+SELECT GROUP_CONCAT(a) FROM t1;
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
+
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id;
+SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
+
+DROP TABLE t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (igor:1.2407) BUG#12863igor7 Sep