List:Commits« Previous MessageNext Message »
From:eugene Date:June 7 2006 8:40pm
Subject:bk commit into 5.0 tree (evgen:1.2162) BUG#18175
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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.2162 06/06/08 00:40:46 evgen@stripped +6 -0
  Fixed bug#18175:  Union select over 129 tables with a sum function fails.
  
  The mysql_new_select() function was increasing the nest_level counter on
  any call but this counter should be increased only for subselects.
  This results in reporting wrong group function usage on 129th select in union.
  
  The mysql_new_select() function now accepts an additional parameter -
  is_in_union. It is set to 1 when the select to be created is a part of a
  union. In this case it doesn't increase the nest_level counter.

  sql/mysql_priv.h
    1.394 06/06/08 00:39:31 evgen@stripped +1 -1
     Fixed bug#18175: Union select over 129 tables with a sum function fails.
    The mysql_new_select() function now accepts an additional parameter -
    is_in_union.

  sql/sql_lex.h
    1.217 06/06/08 00:34:48 evgen@stripped +2 -1
    Fixed bug#18175: Union select over 129 tables with a sum function fails.
    The mysql_new_select() function now accepts an additional parameter -
    is_in_union.

  sql/sql_parse.cc
    1.548 06/06/08 00:31:44 evgen@stripped +3 -2
    Fixed bug#18175: Union select over 129 tables with a sum function fails.
    Now the mysql_new_select() increases the nest_level counter only is the select to be created not a part of a union.

  sql/sql_yacc.yy
    1.470 06/06/08 00:17:22 evgen@stripped +3 -3
    Fixed bug#18175: Union select over 129 tables with a sum function fails.
    The last parameter to the mysql_new_select() is set 1 when the select to be created is a part of a
    union. 

  mysql-test/r/union.result
    1.82 06/06/08 00:16:55 evgen@stripped +45 -0
    Added test case for the bug#18175: Union select over 129 tables with a sum function fails.

  mysql-test/t/union.test
    1.95 06/06/08 00:16:07 evgen@stripped +48 -0
    Added test case for the bug#18175: Union select over 129 tables with a sum function fails.

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/18175-bug-5.0-opt

--- 1.393/sql/mysql_priv.h	2006-05-26 12:51:14 +04:00
+++ 1.394/sql/mysql_priv.h	2006-06-08 00:39:31 +04:00
@@ -620,7 +620,7 @@
 void mysql_init_select(LEX *lex);
 void mysql_reset_thd_for_next_command(THD *thd);
 void mysql_init_query(THD *thd, uchar *buf, uint length);
-bool mysql_new_select(LEX *lex, bool move_down);
+bool mysql_new_select(LEX *lex, bool move_down, bool is_in_union);
 void create_select_for_variable(const char *var_name);
 void mysql_init_multi_delete(LEX *lex);
 bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);

--- 1.216/sql/sql_lex.h	2006-05-08 00:25:36 +04:00
+++ 1.217/sql/sql_lex.h	2006-06-08 00:34:48 +04:00
@@ -365,7 +365,8 @@
   virtual void set_lock_for_tables(thr_lock_type lock_type) {}
 
   friend class st_select_lex_unit;
-  friend bool mysql_new_select(struct st_lex *lex, bool move_down);
+  friend bool mysql_new_select(struct st_lex *lex, bool move_down,
+                               bool is_in_union);
   friend bool mysql_make_view(THD *thd, File_parser *parser,
                               TABLE_LIST *table);
 private:

--- 1.547/sql/sql_parse.cc	2006-05-29 19:07:33 +04:00
+++ 1.548/sql/sql_parse.cc	2006-06-08 00:31:44 +04:00
@@ -5548,7 +5548,7 @@
 
 
 bool
-mysql_new_select(LEX *lex, bool move_down)
+mysql_new_select(LEX *lex, bool move_down, bool is_in_union)
 {
   SELECT_LEX *select_lex;
   THD *thd= lex->thd;
@@ -5560,7 +5560,8 @@
   select_lex->parent_lex= lex; /* Used in init_query. */
   select_lex->init_query();
   select_lex->init_select();
-  lex->nest_level++;
+  if (!is_in_union)
+    lex->nest_level++;
   select_lex->nest_level= lex->nest_level;
   /*
     Don't evaluate this subquery during statement prepare even if

--- 1.469/sql/sql_yacc.yy	2006-05-15 00:51:02 +04:00
+++ 1.470/sql/sql_yacc.yy	2006-06-08 00:17:22 +04:00
@@ -5358,7 +5358,7 @@
 	    YYABORT;
 	  }
 	  if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
-              mysql_new_select(lex, 1))
+              mysql_new_select(lex, 1, 0))
 	    YYABORT;
 	  mysql_init_select(lex);
 	  lex->current_select->linkage= DERIVED_TABLE_TYPE;
@@ -8752,7 +8752,7 @@
             yyerror(ER(ER_SYNTAX_ERROR));
 	    YYABORT;
 	  }
-	  if (mysql_new_select(lex, 0))
+	  if (mysql_new_select(lex, 0, 1))
 	    YYABORT;
           mysql_init_select(lex);
 	  lex->current_select->linkage=UNION_TYPE;
@@ -8862,7 +8862,7 @@
             yyerror(ER(ER_SYNTAX_ERROR));
 	    YYABORT;
 	  }
-	  if (mysql_new_select(Lex, 1))
+	  if (mysql_new_select(Lex, 1, 0))
 	    YYABORT;
 	};
 

--- 1.81/mysql-test/r/union.result	2006-03-06 15:19:38 +03:00
+++ 1.82/mysql-test/r/union.result	2006-06-08 00:16:55 +04:00
@@ -1306,3 +1306,48 @@
 5
 99
 drop table t1;
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1));
+avg(1)
+NULL

--- 1.94/mysql-test/t/union.test	2006-03-06 15:19:38 +03:00
+++ 1.95/mysql-test/t/union.test	2006-06-08 00:16:07 +04:00
@@ -793,3 +793,51 @@
 drop table t1;
 
 # End of 4.1 tests
+
+#
+# Bug#18175: Union select over 129 tables with a sum function fails.
+#
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1)) union
+(select avg(1)) union (select avg(1)) union (select avg(1));
+
Thread
bk commit into 5.0 tree (evgen:1.2162) BUG#18175eugene7 Jun