List:Internals« Previous MessageNext Message »
From:sinisa Date:February 10 2004 7:34pm
Subject:bk commit into 4.1 tree (Sinisa:1.1674)
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.1674 04/02/10 21:34:25 Sinisa@stripped +5 -0
  Fixes for bugs #2508 and #2552

  sql/sql_union.cc
    1.99 04/02/10 21:34:18 Sinisa@stripped +4 -0
    a fix for a bug #2552

  sql/sql_select.cc
    1.293 04/02/10 21:34:18 Sinisa@stripped +4 -0
    A fix for a bug #2508

  sql/sql_class.h
    1.210 04/02/10 21:34:18 Sinisa@stripped +2 -2
    A fix for a bug #2508

  mysql-test/t/union.test
    1.53 04/02/10 21:34:18 Sinisa@stripped +9 -0
    Test cases for bugs #2508 and #2552

  mysql-test/r/union.result
    1.55 04/02/10 21:34:18 Sinisa@stripped +30 -6
    Test cases for bugs #2508 and #2552

# 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.209/sql/sql_class.h	Mon Jan 19 20:56:33 2004
+++ 1.210/sql/sql_class.h	Tue Feb 10 21:34:18 2004
@@ -1075,11 +1075,11 @@
   uint  hidden_field_count;
   uint	group_parts,group_length,group_null_parts;
   uint	quick_group;
-  bool  using_indirect_summary_function;
+  bool  using_indirect_summary_function, all_nulls;
 
   TMP_TABLE_PARAM()
     :copy_funcs_it(copy_funcs), copy_field(0), group_parts(0),
-    group_length(0), group_null_parts(0)
+    group_length(0), group_null_parts(0), all_nulls(0)
   {}
   ~TMP_TABLE_PARAM()
   {

--- 1.292/sql/sql_select.cc	Mon Jan 19 19:06:24 2004
+++ 1.293/sql/sql_select.cc	Tue Feb 10 21:34:18 2004
@@ -4946,6 +4946,8 @@
 			     tmp_from_field, group != 0,not_all_columns);
 	  if (!new_field)
 	    goto err;					// Should be OOM
+	  if (param->all_nulls)
+	    new_field->flags&= ~NOT_NULL_FLAG;	// Because of outer join
 	  tmp_from_field++;
 	  *(reg_field++)= new_field;
 	  reclength+=new_field->pack_length();
@@ -4981,6 +4983,8 @@
 	  goto err;				// Got OOM
 	continue;				// Some kindf of const item
       }
+      if (param->all_nulls)
+	new_field->flags&= ~NOT_NULL_FLAG;	// Because of outer join
       if (type == Item::SUM_FUNC_ITEM)
 	((Item_sum *) item)->result_field= new_field;
       tmp_from_field++;

--- 1.54/mysql-test/r/union.result	Fri Dec 19 16:25:45 2003
+++ 1.55/mysql-test/r/union.result	Tue Feb 10 21:34:18 2004
@@ -539,7 +539,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` char(2) NOT NULL default ''
+  `a` char(2) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT 12 as a UNION select "aa" as a;
@@ -550,7 +550,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` char(2) NOT NULL default ''
+  `a` char(2) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -561,7 +561,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` double(4,1) NOT NULL default '0.0'
+  `a` double(4,1) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
@@ -585,7 +585,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `it2` int(11) NOT NULL default '0'
+  `it2` int(11) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT i from t2 UNION select f from t2;
@@ -799,7 +799,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `1` bigint(1) NOT NULL default '0'
+  `1` bigint(1) default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 select _latin1"test" union select _latin2"testt" ;
@@ -808,7 +808,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `test` char(5) character set latin2 NOT NULL default ''
+  `test` char(5) character set latin2 default NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 (s char(200));
@@ -868,4 +868,28 @@
 show status like 'Slow_queries';
 Variable_name	Value
 Slow_queries	3
+drop table t1;
+create table t1 (   RID int(11) not null default '0',   IID int(11) not null default '0',    nada varchar(50)  not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
+insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
+select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
+NAME	PHONE	NAME	PHONE
+a	111	NULL	NULL
+b	222	NULL	NULL
+d	444	d	454
+NULL	NULL	f	666
+NULL	NULL	g	777
+drop  table t1;
+create table t1 (  id int,  name char(10) not null,  name2 char(10) not null ) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1  union all  select name from t1 union all select id from t1;
+name2
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
 drop table t1;

--- 1.52/mysql-test/t/union.test	Fri Dec 19 16:25:45 2003
+++ 1.53/mysql-test/t/union.test	Tue Feb 10 21:34:18 2004
@@ -465,3 +465,12 @@
 select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
 show status like 'Slow_queries';
 drop table t1;
+create table t1 (   RID int(11) not null default '0',   IID int(11) not null default '0',    nada varchar(50)  not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
+insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
+select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
+drop  table t1;
+create table t1 (  id int,  name char(10) not null,  name2 char(10) not null ) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1  union all  select name from t1 union all select id from t1;
+drop table t1;
+

--- 1.98/sql/sql_union.cc	Sat Jan 17 17:18:27 2004
+++ 1.99/sql/sql_union.cc	Tue Feb 10 21:34:18 2004
@@ -206,6 +206,7 @@
   if (first_select->next_select())
   {
     union_result->tmp_table_param.field_count= types.elements;
+    union_result->tmp_table_param.all_nulls= true;
     if (!(table= create_tmp_table(thd_arg,
 				  &union_result->tmp_table_param, types,
 				  (ORDER*) 0, !union_option, 1, 
@@ -315,6 +316,7 @@
 	  if it use same tables
 	*/
 	uint tablenr=0;
+	ulong query_id= thd->query_id;
 	for (TABLE_LIST *table_list= (TABLE_LIST*) sl->table_list.first;
 	     table_list;
 	     table_list= table_list->next, tablenr++)
@@ -329,6 +331,8 @@
 	    */
 	    setup_table_map(table_list->table, table_list, tablenr);
 	  }
+	  for (unsigned int i=0; i < table_list->table->fields; i++)
+	    table_list->table->field[i]->query_id= query_id;
 	}
 	res= sl->join->optimize();
       }
Thread
bk commit into 4.1 tree (Sinisa:1.1674)sinisa10 Feb