List:Internals« Previous MessageNext Message »
From:sinisa Date:May 3 2004 4:15pm
Subject:bk commit into 4.1 tree (Sinisa:1.1804)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of Sinisa. When Sinisa 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1804 04/05/03 19:15:26 Sinisa@stripped +3 -0
  Fix for a bug involving UNION's and SET SQL_SELECT_LIMIT 

  sql/sql_union.cc
    1.113 04/05/03 19:15:19 Sinisa@stripped +12 -3
    Patch  for a bug involving UNION's and SET SQL_SELECT_LIMIT 

  mysql-test/t/union.test
    1.63 04/05/03 19:15:19 Sinisa@stripped +4 -0
    Test case for bug involving UNION's and 
    SET SQL_SELECT_LIMIT 

  mysql-test/r/union.result
    1.66 04/05/03 19:15:19 Sinisa@stripped +11 -0
    Results for a test case for bug involving UNION's and 
    SET SQL_SELECT_LIMIT 

# 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:	Sinisa
# Host:	sinisa.nasamreza.org
# Root:	/mnt/work/mysql-4.1

--- 1.65/mysql-test/r/union.result	Wed Apr  7 13:26:18 2004
+++ 1.66/mysql-test/r/union.result	Mon May  3 19:15:19 2004
@@ -924,3 +924,14 @@
 1
 2
 2
+set sql_select_limit=1;
+select 1 union select 2;
+1
+1
+(select 1) union (select 2);
+1
+1
+(select 1) union (select 2) union (select 3) limit 2;
+1
+1
+2

--- 1.62/mysql-test/t/union.test	Sun Apr  4 03:05:41 2004
+++ 1.63/mysql-test/t/union.test	Mon May  3 19:15:19 2004
@@ -498,4 +498,8 @@
 select * from t1 UNION select * from t1 UNION ALL select * from t1;
 drop table t1;
 select 1 as a union all select 1 union all select 2 union select 1 union all select 2;
+set sql_select_limit=1;
+select 1 union select 2;
+(select 1) union (select 2);
+(select 1) union (select 2) union (select 3) limit 2;
 

--- 1.112/sql/sql_union.cc	Thu Apr  8 00:16:12 2004
+++ 1.113/sql/sql_union.cc	Mon May  3 19:15:19 2004
@@ -377,12 +377,21 @@
     if (!thd->is_fatal_error)				// Check if EOM
     {
       ulong options_tmp= thd->options;
+      /*
+	We have to take into the account a case when:
+	SET SQL_SELECT_LIMIT was set.
+	In mysql_new_select() function this value was copied to 
+	the fake_select_lex node of the top-level unit.
+	Here below, we just take this value if global LIMIT was not applied
+	to the entire UNION.
+      */
+      ha_rows select_limit= ((global_parameters->select_limit != HA_POS_ERROR) ? 
+			     global_parameters->select_limit : fake_select_lex->select_limit);
       thd->lex->current_select= fake_select_lex;
       offset_limit_cnt= global_parameters->offset_limit;
-      select_limit_cnt= global_parameters->select_limit +
-	global_parameters->offset_limit;
+      select_limit_cnt= select_limit + 	global_parameters->offset_limit;
 
-      if (select_limit_cnt < global_parameters->select_limit)
+      if (select_limit_cnt < select_limit)
 	select_limit_cnt= HA_POS_ERROR;		// no limit
       if (select_limit_cnt == HA_POS_ERROR)
 	options_tmp&= ~OPTION_FOUND_ROWS;
Thread
bk commit into 4.1 tree (Sinisa:1.1804)sinisa3 May