List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:August 20 2010 11:23am
Subject:bzr commit into mysql-5.5-merge branch (Georgi.Kodinov:3175)
View as plain text  
#At file:///home/kgeorge/mysql/work/merge-5.5-merge/ based on revid:mattias.jonsson@stripped

 3175 Georgi Kodinov	2010-08-20 [merge]
      merge

    modified:
      mysql-test/r/func_gconcat.result
      mysql-test/r/func_misc.result
      mysql-test/suite/rpl/t/rpl_drop.test
      mysql-test/t/func_gconcat.test
      mysql-test/t/func_misc.test
      sql/item_func.cc
      sql/item_sum.cc
      sql/log.h
      sql/table.h
=== modified file 'mysql-test/r/func_gconcat.result'
--- a/mysql-test/r/func_gconcat.result	2010-04-03 17:35:51 +0000
+++ b/mysql-test/r/func_gconcat.result	2010-08-20 11:22:46 +0000
@@ -1003,6 +1003,7 @@ SELECT 1 FROM
 1
 1
 DROP TABLE t1;
+End of 5.0 tests
 #
 # Bug #52397: another crash with explain extended and group_concat
 #
@@ -1019,6 +1020,25 @@ Warnings:
 Note	1003	select 1 AS `1` from dual
 DROP TABLE t1;
 End of 5.0 tests
+#
+# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+# 
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 5.1 tests
 DROP TABLE IF EXISTS t1, t2;
 CREATE TABLE t1 (a VARCHAR(6), b INT);
 CREATE TABLE t2 (a VARCHAR(6), b INT);

=== modified file 'mysql-test/r/func_misc.result'
--- a/mysql-test/r/func_misc.result	2010-04-07 09:59:02 +0000
+++ b/mysql-test/r/func_misc.result	2010-08-20 11:22:46 +0000
@@ -337,6 +337,21 @@ select connection_id() > 0;
 connection_id() > 0
 1
 #
+# Bug #54461: crash with longblob and union or update with subquery
+#
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+LEAST(a, (SELECT b FROM t1 LIMIT 1))
+1
+2
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+GREATEST(a, (SELECT b FROM t1 LIMIT 1))
+2
+3
+1
+DROP TABLE t1;
+#
 # Bug #52165: Assertion failed: file .\dtoa.c, line 465
 # 
 CREATE TABLE t1 (a SET('a'), b INT);

=== modified file 'mysql-test/suite/rpl/t/rpl_drop.test'
--- a/mysql-test/suite/rpl/t/rpl_drop.test	2009-11-27 23:34:47 +0000
+++ b/mysql-test/suite/rpl/t/rpl_drop.test	2010-08-20 11:22:46 +0000
@@ -10,3 +10,4 @@ drop table t1, t2;
 sync_slave_with_master;
 
 # End of 4.1 tests
+

=== modified file 'mysql-test/t/func_gconcat.test'
--- a/mysql-test/t/func_gconcat.test	2010-04-03 17:35:51 +0000
+++ b/mysql-test/t/func_gconcat.test	2010-08-20 11:22:46 +0000
@@ -708,6 +708,7 @@ SELECT 1 FROM
 
 DROP TABLE t1;
 
+--echo End of 5.0 tests
 
 --echo #
 --echo # Bug #52397: another crash with explain extended and group_concat
@@ -722,6 +723,26 @@ DROP TABLE t1;
 
 --echo End of 5.0 tests
 
+
+--echo #
+--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+--echo # 
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+
+--echo End of 5.1 tests
+
+
+
 #
 # Bug#36785: Wrong error message when group_concat() exceeds max length
 #

=== modified file 'mysql-test/t/func_misc.test'
--- a/mysql-test/t/func_misc.test	2010-04-07 09:59:02 +0000
+++ b/mysql-test/t/func_misc.test	2010-08-20 11:22:46 +0000
@@ -468,6 +468,19 @@ select NAME_CONST('_id',1234) as id;
 select connection_id() > 0;
 
 --echo #
+--echo # Bug #54461: crash with longblob and union or update with subquery
+--echo #
+
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+
+DROP TABLE t1;
+
+
+--echo #
 --echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465
 --echo # 
 
@@ -478,4 +491,5 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1
 
 DROP TABLE t1;
 
+
 --echo End of tests

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2010-07-15 13:47:50 +0000
+++ b/sql/item_func.cc	2010-08-20 11:22:46 +0000
@@ -2531,6 +2531,8 @@ void Item_func_min_max::fix_length_and_d
                                                                  decimals,
                                                                  unsigned_flag));
   }
+  else if (cmp_type == REAL_RESULT)
+    fix_char_length(float_length(decimals));
   cached_field_type= agg_field_type(args, arg_count);
 }
 

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2010-08-17 12:12:52 +0000
+++ b/sql/item_sum.cc	2010-08-20 11:22:46 +0000
@@ -3059,7 +3059,6 @@ Item_func_group_concat::Item_func_group_
   tree(item->tree),
   unique_filter(item->unique_filter),
   table(item->table),
-  order(item->order),
   context(item->context),
   arg_count_order(item->arg_count_order),
   arg_count_field(item->arg_count_field),
@@ -3072,6 +3071,24 @@ Item_func_group_concat::Item_func_group_
 {
   quick_group= item->quick_group;
   result.set_charset(collation.collation);
+
+  /*
+    Since the ORDER structures pointed to by the elements of the 'order' array
+    may be modified in find_order_in_list() called from
+    Item_func_group_concat::setup(), create a copy of those structures so that
+    such modifications done in this object would not have any effect on the
+    object being copied.
+  */
+  ORDER *tmp;
+  if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order +
+                                     sizeof(ORDER) * arg_count_order)))
+    return;
+  tmp= (ORDER *)(order + arg_count_order);
+  for (uint i= 0; i < arg_count_order; i++, tmp++)
+  {
+    memcpy(tmp, item->order[i], sizeof(ORDER));
+    order[i]= tmp;
+  }
 }
 
 

=== modified file 'sql/log.h'
--- a/sql/log.h	2010-07-23 20:13:36 +0000
+++ b/sql/log.h	2010-08-20 11:22:46 +0000
@@ -394,10 +394,10 @@ public:
   /* Use this to start writing a new log file */
   void new_file();
 
-  bool write(Log_event* event_info);
+  bool write(Log_event* event_info); // binary log write
   bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
-  bool write_incident(THD *thd, bool lock);
 
+  bool write_incident(THD *thd, bool lock);
   int  write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
   void set_write_error(THD *thd);
   bool check_write_error(THD *thd);

=== modified file 'sql/table.h'
--- a/sql/table.h	2010-07-29 03:24:35 +0000
+++ b/sql/table.h	2010-08-20 11:22:46 +0000
@@ -205,7 +205,6 @@ typedef struct st_order {
   struct st_order *next;
   Item	 **item;			/* Point at item in select fields */
   Item	 *item_ptr;			/* Storage for initial item */
-  Item   **item_copy;			/* For SPs; the original item ptr */
   int    counter;                       /* position in SELECT list, correct
                                            only if counter_used is true*/
   bool	 asc;				/* true if ascending */


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100820112246-wgmtg4ka7957bhf2.bundle
Thread
bzr commit into mysql-5.5-merge branch (Georgi.Kodinov:3175) Georgi Kodinov20 Aug