List:Internals« Previous MessageNext Message »
From:sinisa Date:August 6 2003 3:48pm
Subject:bk commit into 4.1 tree (1.1585)
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.1585 03/08/06 18:48:34 Sinisa@stripped +4 -0
  sql_union.cc, sql_select.cc:
    Code clean-up
  sql_union.cc, union.test, union.result:
    A fix for a bug #978.
    This enables that NULL's can be entered into UNION's result set,
    although first SELECT columns are NOT NULL.
    This is also a start of fixing UNION's properly regarding type
    acceptance.
  sql_select.cc:
    A commit for my second July SPRINT task

  sql/sql_union.cc
    1.81 03/08/06 18:41:38 Sinisa@stripped +0 -8
    Code clean-up

  sql/sql_select.cc
    1.237 03/08/06 18:41:37 Sinisa@stripped +0 -11
    Code clean-up

  sql/sql_union.cc
    1.80 03/08/05 18:55:59 Sinisa@stripped +6 -2
    A fix for a bug #978.
    
    This enables that NULL's can be entered into UNION's result set,
    although first SELECT columns are NOT NULL.
    
    This is also a start of fixing UNION's properly regarding type
    acceptance.

  sql/sql_select.cc
    1.236 03/08/05 18:55:59 Sinisa@stripped +11 -0
    A commit for my second July SPRINT task

  mysql-test/t/union.test
    1.38 03/08/05 18:55:59 Sinisa@stripped +9 -0
    A fix for a bug #978.
    
    This enables that NULL's can be entered into UNION's result set,
    although first SELECT columns are NOT NULL.
    
    This is also a start of fixing UNION's properly regarding type
    acceptance.

  mysql-test/r/union.result
    1.40 03/08/05 18:55:58 Sinisa@stripped +13 -0
    A fix for a bug #978.
    
    This enables that NULL's can be entered into UNION's result set,
    although first SELECT columns are NOT NULL.
    
    This is also a start of fixing UNION's properly regarding type
    acceptance.

# 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.39/mysql-test/r/union.result	Wed Jun  4 18:28:47 2003
+++ 1.40/mysql-test/r/union.result	Tue Aug  5 18:55:58 2003
@@ -328,3 +328,16 @@
 1	PRIMARY	t1	const	PRIMARY	PRIMARY	4	const	1	
 2	UNION	t1	ref	b	b	5	const	1	Using where
 drop table t1,t2;
+create table t1 (   id int not null auto_increment, primary key (id)   ,user_name text );
+create table t2 (    id int not null auto_increment, primary key (id)   ,group_name text );
+create table t3 (    id int not null auto_increment, primary key (id)   ,user_id int   ,index user_idx (user_id)   ,foreign key (user_id) references users(id)   ,group_id int   ,index group_idx (group_id)   ,foreign key (group_id) references groups(id) );
+insert into t1 (user_name) values ('Tester');
+insert into t2 (group_name) values ('Group A');
+insert into t2 (group_name) values ('Group B');
+insert into t3 (user_id, group_id) values (1,1);
+select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION  select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
+is_in_group	user_name	group_name	id
+1	Tester	Group A	1
+0	Tester	Group A	NULL
+0	Tester	Group B	NULL
+drop table t1, t2, t3;

--- 1.37/mysql-test/t/union.test	Mon May 19 16:35:45 2003
+++ 1.38/mysql-test/t/union.test	Tue Aug  5 18:55:59 2003
@@ -209,3 +209,12 @@
 explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
 explain (select * from t1 where a=1) union (select * from t1 where b=1);
 drop table t1,t2;
+create table t1 (   id int not null auto_increment, primary key (id)   ,user_name text );
+create table t2 (    id int not null auto_increment, primary key (id)   ,group_name text );
+create table t3 (    id int not null auto_increment, primary key (id)   ,user_id int   ,index user_idx (user_id)   ,foreign key (user_id) references users(id)   ,group_id int   ,index group_idx (group_id)   ,foreign key (group_id) references groups(id) );
+insert into t1 (user_name) values ('Tester');
+insert into t2 (group_name) values ('Group A');
+insert into t2 (group_name) values ('Group B');
+insert into t3 (user_id, group_id) values (1,1);
+select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION  select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
+drop table t1, t2, t3;

--- 1.79/sql/sql_union.cc	Sat Jul 19 18:46:43 2003
+++ 1.81/sql/sql_union.cc	Wed Aug  6 18:41:38 2003
@@ -154,8 +154,6 @@
       goto err;
     List_iterator<Item> it(select_cursor->item_list);	
     Item *item;
-    while((item=it++))
-      item->maybe_null=1;
     item_list= select_cursor->item_list;
     select_cursor->with_wild= 0;
     if (setup_ref_array(thd, &select_cursor->ref_pointer_array, 
@@ -166,6 +164,12 @@
 		     item_list, 0, 0, 1))
       goto err;
     t_and_f= 1;
+    while((item=it++))
+    {
+      item->maybe_null=1;
+      if (item->type() == Item::FIELD_ITEM)
+	((class Item_field *)item)->field->table->maybe_null=1;
+    }
   }
 
   tmp_table_param.field_count=item_list.elements;
@@ -249,7 +253,6 @@
 
 int st_select_lex_unit::exec()
 {
-  int do_print_slow= 0;
   SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
   SELECT_LEX *select_cursor=first_select_in_union();
   DBUG_ENTER("st_select_lex_unit::exec");
@@ -317,7 +320,6 @@
 	thd->lex.current_select= lex_select_save;
 	DBUG_RETURN(res);
       }
-      do_print_slow|= select_cursor->options;
     }
   }
   optimized= 1;
@@ -360,12 +362,6 @@
 	Mark for slow query log if any of the union parts didn't use
 	indexes efficiently
       */
-      select_cursor->options= ((select_cursor->options &
-				~(QUERY_NO_INDEX_USED |
-				  QUERY_NO_GOOD_INDEX_USED)) |
-			       do_print_slow &
-			       (QUERY_NO_INDEX_USED |
-				QUERY_NO_GOOD_INDEX_USED));
     }
   }
   thd->lex.current_select= lex_select_save;
Thread
bk commit into 4.1 tree (1.1585)sinisa6 Aug