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-07 22:22:19+03:00, evgen@stripped +4 -0
Merge moonbone.local:/mnt/gentoo64/work/22331-bug-5.0-opt-mysql
into moonbone.local:/mnt/gentoo64/work/25373-bug-5.0-opt-mysql
MERGE: 1.2377.27.8
mysql-test/r/subselect.result@stripped, 2007-03-07 22:21:23+03:00, evgen@stripped +0
-0
Auto merged
MERGE: 1.172.1.1
sql/sql_lex.cc@stripped, 2007-03-07 22:22:18+03:00, evgen@stripped +0 -0
SCCS merged
MERGE: 1.209.2.1
sql/sql_lex.h@stripped, 2007-03-07 22:21:23+03:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.233.4.1
sql/sql_select.cc@stripped, 2007-03-07 22:21:23+03:00, evgen@stripped +0 -0
Auto merged
MERGE: 1.488.1.3
# 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/RESYNC
--- 1.213/sql/sql_lex.cc 2007-02-26 15:57:41 +03:00
+++ 1.214/sql/sql_lex.cc 2007-03-07 22:22:18 +03:00
@@ -1195,6 +1195,7 @@
is_correlated= 0;
cur_pos_in_select_list= UNDEF_POS;
non_agg_fields.empty();
+ cond_value= having_value= Item::COND_UNDEF;
inner_refs_list.empty();
}
--- 1.238/sql/sql_lex.h 2007-02-26 15:57:41 +03:00
+++ 1.239/sql/sql_lex.h 2007-03-07 22:21:23 +03:00
@@ -488,6 +488,8 @@
Item *where, *having; /* WHERE & HAVING clauses */
Item *prep_where; /* saved WHERE clause for prepared statement processing */
Item *prep_having;/* saved HAVING clause for prepared statement processing */
+ /* Saved values of the WHERE and HAVING clauses*/
+ Item::cond_result cond_value, having_value;
/* point on lex in which it was created, used in view subquery detection */
st_lex *parent_lex;
enum olap_type olap;
--- 1.496/sql/sql_select.cc 2007-03-05 23:33:56 +03:00
+++ 1.497/sql/sql_select.cc 2007-03-07 22:21:23 +03:00
@@ -749,7 +749,6 @@
}
{
- Item::cond_result having_value;
having= optimize_cond(this, having, join_list, &having_value);
if (thd->net.report_error)
{
@@ -757,6 +756,10 @@
DBUG_PRINT("error",("Error from optimize_cond"));
DBUG_RETURN(1);
}
+ if (select_lex->where)
+ select_lex->cond_value= cond_value;
+ if (select_lex->having)
+ select_lex->having_value= having_value;
if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options &
OPTION_FOUND_ROWS)))
@@ -897,6 +900,7 @@
conds->update_used_tables();
DBUG_EXECUTE("where", print_where(conds, "after substitute_best_equal"););
}
+
/*
Permorm the the optimization on fields evaluation mentioned above
for all on expressions.
@@ -7606,6 +7610,9 @@
break;
}
}
+ if (!((Item_cond*)cond)->argument_list()->elements)
+ cond= new Item_int(cond->val_bool());
+
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
@@ -15324,10 +15331,13 @@
Item *cur_where= where;
if (join)
cur_where= join->conds;
- if (cur_where)
+ if (cur_where || cond_value != Item::COND_UNDEF)
{
str->append(STRING_WITH_LEN(" where "));
- cur_where->print(str);
+ if (cur_where)
+ cur_where->print(str);
+ else
+ str->append(cond_value != Item::COND_FALSE ? "1" : "0");
}
// group by & olap
@@ -15353,10 +15363,13 @@
if (join)
cur_having= join->having;
- if (cur_having)
+ if (cur_having || having_value != Item::COND_UNDEF)
{
str->append(STRING_WITH_LEN(" having "));
- cur_having->print(str);
+ if (cur_having)
+ cur_having->print(str);
+ else
+ str->append(having_value != Item::COND_FALSE ? "1" : "0");
}
if (order_list.elements)
--- 1.173/mysql-test/r/subselect.result 2007-02-21 22:59:50 +03:00
+++ 1.174/mysql-test/r/subselect.result 2007-03-07 22:21:23 +03:00
@@ -421,7 +421,7 @@
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1`
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -1180,7 +1180,7 @@
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from
`test`.`t1` `a`)) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from
`test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 0 IN (SELECT 1 FROM t1 a);
0 IN (SELECT 1 FROM t1 a)
@@ -1190,7 +1190,7 @@
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
Warnings:
-Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from
`test`.`t1` `a`)) AS `0 IN (SELECT 1 FROM t1 a)`
+Note 1003 select <in_optimizer>(0,<exists>(select 1 AS `Not_used` from
`test`.`t1` `a` where 0)) AS `0 IN (SELECT 1 FROM t1 a)`
drop table t1;
CREATE TABLE `t1` (
`i` int(11) NOT NULL default '0',
@@ -1532,7 +1532,7 @@
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible 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`
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= any (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
@@ -1540,7 +1540,7 @@
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible 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`
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2);
a
explain extended select * from t3 where NULL >= some (select b from t2);
@@ -1548,7 +1548,7 @@
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible 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`
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
select * from t3 where NULL >= some (select b from t2 group by 1);
a
explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
@@ -1556,7 +1556,7 @@
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible 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`
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -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`
+Note 1003 select `test`.`t1`.`s1` 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');
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2433) | eugene | 7 Mar |