MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:March 9 2007 9:29pm
Subject:bk commit into 5.0 tree (evgen:1.2435) BUG#22331
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@stripped, 2007-03-10 00:29:02+03:00, evgen@stripped +12 -0
  Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
  away.
  
  Additional fix for bug#22331. Now Item_field prints its value in the case of
  the const field.

  mysql-test/r/explain.result@stripped, 2007-03-10 00:18:45+03:00, evgen@stripped +3 -3
    Corrected test case after fix for bug#22331.

  mysql-test/r/func_default.result@stripped, 2007-03-10 00:18:44+03:00, evgen@stripped +1 -1
    Corrected test case after fix for bug#22331.

  mysql-test/r/func_regexp.result@stripped, 2007-03-10 00:18:43+03:00, evgen@stripped +1 -1
    Corrected test case after fix for bug#22331.

  mysql-test/r/func_str.result@stripped, 2007-03-10 00:18:43+03:00, evgen@stripped +3 -3
    Corrected test case after fix for bug#22331.

  mysql-test/r/func_test.result@stripped, 2007-03-10 00:18:42+03:00, evgen@stripped +1 -1
    Corrected test case after fix for bug#22331.

  mysql-test/r/having.result@stripped, 2007-03-10 00:18:42+03:00, evgen@stripped +1 -1
    Corrected test case after fix for bug#22331.

  mysql-test/r/subselect.result@stripped, 2007-03-10 00:18:41+03:00, evgen@stripped +11 -11
    Corrected test case after fix for bug#22331.

  mysql-test/r/union.result@stripped, 2007-03-10 00:18:40+03:00, evgen@stripped +1 -1
    Corrected test case after fix for bug#22331.

  mysql-test/r/varbinary.result@stripped, 2007-03-10 00:18:36+03:00, evgen@stripped +1 -1
    Corrected test case after fix for bug#22331.

  sql/item.cc@stripped, 2007-03-10 00:19:26+03:00, evgen@stripped +19 -2
    Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
    away.
    Added the print() member function to the Item_field class.

  sql/item.h@stripped, 2007-03-10 00:19:10+03:00, evgen@stripped +1 -0
    Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
    away.
    Added the print() member function to the Item_field class.

  sql/sql_union.cc@stripped, 2007-03-10 00:18:58+03:00, evgen@stripped +6 -0
    Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
    away.
    Cleanup of the SELECT_LEX::order_list list.

# 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:	/mnt/gentoo64/work/25373-bug-5.0-opt-mysql

--- 1.252/sql/item.cc	2007-03-05 06:54:30 +03:00
+++ 1.253/sql/item.cc	2007-03-10 00:19:26 +03:00
@@ -1758,9 +1758,10 @@
     }
   }
 
-  if (!table_name || !field_name)
+  if (!table_name || !field_name || !field_name[0])
   {
-    const char *nm= field_name ? field_name : name ? name : "tmp_field";
+    const char *nm= (field_name && field_name[0]) ?
+                      field_name : name ? name : "tmp_field";
     append_identifier(thd, str, nm, (uint) strlen(nm));
     return;
   }
@@ -4897,6 +4898,22 @@
     return ref;
   }
   return this;
+}
+
+
+void Item_field::print(String *str)
+{
+  if (field && field->table->const_table)
+  {
+    char buff[MAX_FIELD_WIDTH];
+    String tmp(buff,sizeof(buff),str->charset());
+    field->val_str(&tmp);
+    str->append('\'');
+    str->append(tmp);
+    str->append('\'');
+    return;
+  }
+  Item_ident::print(str);
 }
 
 

--- 1.220/sql/item.h	2007-03-05 06:54:30 +03:00
+++ 1.221/sql/item.h	2007-03-10 00:19:10 +03:00
@@ -1303,6 +1303,7 @@
   Item *safe_charset_converter(CHARSET_INFO *tocs);
   int fix_outer_field(THD *thd, Field **field, Item **reference);
   virtual Item *update_value_transformer(byte *select_arg);
+  void print(String *str);
   friend class Item_default_value;
   friend class Item_insert_value;
   friend class st_select_lex_unit;

--- 1.87/mysql-test/r/union.result	2006-10-13 03:10:30 +04:00
+++ 1.88/mysql-test/r/union.result	2007-03-10 00:18:40 +03:00
@@ -480,7 +480,7 @@
 2	UNION	t2	const	PRIMARY	PRIMARY	4	const	1	
 NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	
 Warnings:
-Note	1003	(select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` = 1)) union (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` = 1))
+Note	1003	(select '1' AS `a`,'1' AS `b` from `test`.`t1` where ('1' = 1)) union (select '1' AS `a`,'10' AS `b` from `test`.`t2` where ('1' = 1))
 (select * from t1 where a=5) union (select * from t2 where a=1);
 a	b
 1	10

--- 1.139/sql/sql_union.cc	2007-02-26 15:57:42 +03:00
+++ 1.140/sql/sql_union.cc	2007-03-10 00:18:58 +03:00
@@ -621,6 +621,12 @@
       join->tables= 0;
     }
     error|= fake_select_lex->cleanup();
+    if (fake_select_lex->order_list.elements)
+    {
+      ORDER *ord;
+      for (ord= (ORDER*)fake_select_lex->order_list.first; ord; ord= ord->next)
+        (*ord->item)->cleanup();
+    }
   }
 
   DBUG_RETURN(error);

--- 1.5/mysql-test/r/func_default.result	2005-06-14 16:50:19 +04:00
+++ 1.6/mysql-test/r/func_default.result	2007-03-10 00:18:44 +03:00
@@ -8,7 +8,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from `test`.`t1`
+Note	1003	select default('') AS `default(str)`,default('') AS `default(strnull)`,default('0') AS `default(intg)`,default('0') AS `default(rel)` from `test`.`t1`
 select * from t1 where str <> default(str);
 str	strnull	intg	rel
 		0	0

--- 1.174/mysql-test/r/subselect.result	2007-03-07 22:21:23 +03:00
+++ 1.175/mysql-test/r/subselect.result	2007-03-10 00:18:41 +03:00
@@ -50,7 +50,7 @@
 Warnings:
 Note	1276	Field or reference 'a' of SELECT #3 was resolved in SELECT #1
 Note	1276	Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note	1003	select 1 AS `1` from (select 1 AS `a`) `b` having ((select `b`.`a` AS `a`) = 1)
+Note	1003	select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
 1
 1
@@ -204,7 +204,7 @@
 3	DERIVED	t2	ALL	NULL	NULL	NULL	NULL	2	Using where
 2	SUBQUERY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where; Using filesort
 Warnings:
-Note	1003	select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note	1003	select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
 a
 2
@@ -315,7 +315,7 @@
 Warnings:
 Note	1276	Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
 Note	1276	Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
-Note	1003	select (select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+Note	1003	select (select '2' AS `a` from `test`.`t1` where ('2' = `test`.`t2`.`a`) union select `test`.`t5`.`a` AS `a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`)) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
 select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
 ERROR 21000: Subquery returns more than 1 row
 create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
@@ -368,7 +368,7 @@
 2	SUBQUERY	t8	const	PRIMARY	PRIMARY	37	const	1	
 3	SUBQUERY	t8	const	PRIMARY	PRIMARY	37		1	Using index
 Warnings:
-Note	1003	select `test`.`t8`.`pseudo` AS `pseudo`,(select `test`.`t8`.`email` AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
+Note	1003	select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
 t8 WHERE pseudo='joce');
 ERROR 21000: Operand should contain 1 column(s)
@@ -547,7 +547,7 @@
 1	PRIMARY	t1	const	PRIMARY,numreponse	PRIMARY	7	const,const	1	Using index
 2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
 Warnings:
-Note	1003	select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = _latin1'1'))
+Note	1003	select '3' AS `numreponse` from `test`.`t1` where (('1' = _latin1'1'))
 drop table t1;
 CREATE TABLE t1 (a int(1));
 INSERT INTO t1 VALUES (1);
@@ -1430,7 +1430,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	(select `test`.`t1`.`s1` AS `s1` from `test`.`t1`)
+Note	1003	(select 'tttt' AS `s1` from `test`.`t1`)
 (select * from t1);
 s1
 tttt
@@ -1497,7 +1497,7 @@
 1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	SUBQUERY	t2	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
-Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max(`test`.`t2`.`b`) from `test`.`t2`)))
+Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < (select max('0') from `test`.`t2`)))
 select * from t3 where a >= some (select b from t2);
 a
 explain extended select * from t3 where a >= some (select b from t2);
@@ -1505,7 +1505,7 @@
 1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	SUBQUERY	t2	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
-Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min(`test`.`t2`.`b`) from `test`.`t2`)))
+Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= (select min('0') from `test`.`t2`)))
 select * from t3 where a >= all (select b from t2 group by 1);
 a
 6
@@ -1516,7 +1516,7 @@
 1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	SUBQUERY	t2	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
-Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select `test`.`t2`.`b` AS `b` from `test`.`t2` group by 1)))
+Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` < <max>(select '0' AS `b` from `test`.`t2` group by 1)))
 select * from t3 where a >= some (select b from t2 group by 1);
 a
 explain extended select * from t3 where a >= some (select b from t2 group by 1);
@@ -1524,7 +1524,7 @@
 1	PRIMARY	t3	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	SUBQUERY	t2	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
-Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select `test`.`t2`.`b` AS `b` from `test`.`t2` group by 1)))
+Note	1003	select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>((`test`.`t3`.`a` >= <min>(select '0' AS `b` from `test`.`t2` group by 1)))
 select * from t3 where NULL >= any (select b from t2);
 a
 explain extended select * from t3 where NULL >= any (select b from t2);
@@ -1618,7 +1618,7 @@
 3	UNION	t1	system	NULL	NULL	NULL	NULL	1	
 NULL	UNION RESULT	<union2,3>	ALL	NULL	NULL	NULL	NULL	NULL	
 Warnings:
-Note	1003	select `test`.`t1`.`s1` AS `s1` from `test`.`t1` where 1
+Note	1003	select 'e' AS `s1` from `test`.`t1` where 1
 drop table t1;
 CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
 INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');

--- 1.19/mysql-test/r/explain.result	2007-03-08 00:27:00 +03:00
+++ 1.20/mysql-test/r/explain.result	2007-03-10 00:18:45 +03:00
@@ -64,7 +64,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` where 1
+Note	1003	select '1' AS `f1`,'1' AS `f2` from `test`.`t1` where 1
 explain extended select * from t1 where 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
@@ -74,7 +74,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` where 1
+Note	1003	select '1' AS `f1`,'1' AS `f2` from `test`.`t1` where 1
 explain extended select * from t1 having 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible HAVING
@@ -84,6 +84,6 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` having 1
+Note	1003	select '1' AS `f1`,'1' AS `f2` from `test`.`t1` having 1
 drop view v1;
 drop table t1;

--- 1.10/mysql-test/r/func_regexp.result	2004-07-20 09:48:24 +04:00
+++ 1.11/mysql-test/r/func_regexp.result	2007-03-10 00:18:43 +03:00
@@ -40,7 +40,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	select `test`.`t1`.`xxx` AS `xxx` from `test`.`t1` where (`test`.`t1`.`xxx` regexp _latin1'is a test of some long text to')
+Note	1003	select 'this is a test of some long text to see what happens' AS `xxx` from `test`.`t1` where ('this is a test of some long text to see what happens' regexp _latin1'is a test of some long text to')
 select * from t1 where xxx regexp('is a test of some long text to ');
 xxx
 this is a test of some long text to see what happens

--- 1.34/mysql-test/r/func_test.result	2007-03-07 21:31:34 +03:00
+++ 1.35/mysql-test/r/func_test.result	2007-03-10 00:18:42 +03:00
@@ -87,7 +87,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	1	
 Warnings:
-Note	1003	select -(`test`.`t1`.`a`) AS `- a` from `test`.`t1`
+Note	1003	select -('1') AS `- a` from `test`.`t1`
 drop table t1;
 select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
 5 between 0 and 10 between 0 and 1	(5 between 0 and 10) between 0 and 1

--- 1.26/mysql-test/r/having.result	2006-05-17 09:19:36 +04:00
+++ 1.27/mysql-test/r/having.result	2007-03-10 00:18:42 +03:00
@@ -12,7 +12,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 Warnings:
-Note	1003	select count(`test`.`t1`.`a`) AS `b` from `test`.`t1` where 0 having (`b` >= 0)
+Note	1003	select count('0') AS `b` from `test`.`t1` where 0 having (`b` >= 0)
 drop table t1;
 CREATE TABLE t1 (
 raw_id int(10) NOT NULL default '0',

--- 1.17/mysql-test/r/varbinary.result	2006-11-09 14:00:25 +03:00
+++ 1.18/mysql-test/r/varbinary.result	2007-03-10 00:18:36 +03:00
@@ -15,7 +15,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	const	UNIQ	UNIQ	8	const	1	
 Warnings:
-Note	1003	select `test`.`t1`.`ID` AS `ID`,`test`.`t1`.`UNIQ` AS `UNIQ` from `test`.`t1` where 1
+Note	1003	select '00000001' AS `ID`,'004084688022709641610' AS `UNIQ` from `test`.`t1` where 1
 drop table t1;
 select x'hello';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1

--- 1.127/mysql-test/r/func_str.result	2007-03-02 13:14:49 +03:00
+++ 1.128/mysql-test/r/func_str.result	2007-03-10 00:18:43 +03:00
@@ -1089,12 +1089,12 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
-Note	1003	select encode(`test`.`t1`.`f1`,'zxcv') AS `enc` from `test`.`t1`
+Note	1003	select encode('','zxcv') AS `enc` from `test`.`t1`
 explain extended select decode(f1,'zxcv') as 'enc' from t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	system	NULL	NULL	NULL	NULL	0	const row not found
 Warnings:
-Note	1003	select decode(`test`.`t1`.`f1`,'zxcv') AS `enc` from `test`.`t1`
+Note	1003	select decode('','zxcv') AS `enc` from `test`.`t1`
 drop table t1;
 End of 4.1 tests
 create table t1 (d decimal default null);
@@ -1158,7 +1158,7 @@
 1	SIMPLE	t2	const	PRIMARY	PRIMARY	12	const	1	Using index
 1	SIMPLE	t1	ref	code	code	13	const	3	Using where; Using index
 Warnings:
-Note	1003	select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
+Note	1003	select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
 DROP TABLE t1,t2;
 select locate('he','hello',-2);
 locate('he','hello',-2)
Thread
bk commit into 5.0 tree (evgen:1.2435) BUG#22331eugene9 Mar