1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge rurik.mysql.com:/home/igor/dev/mysql-4.1-0

into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0


mysql-test/t/having.test:
  Auto merged
mysql-test/r/having.result:
  Manual merge
sql/sql_lex.cc:
  Manual merge
sql/sql_lex.h:
  Manual merge
sql/sql_prepare.cc:
  Manual merge
sql/sql_select.cc:
  Manual merge
This commit is contained in:
unknown
2006-02-02 21:23:36 -08:00
6 changed files with 183 additions and 20 deletions

View File

@ -612,6 +612,7 @@ JOIN::optimize()
build_bitmap_for_nested_joins(join_list, 0);
sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0;
sel->prep_having= having ? having->copy_andor_structure(thd) : 0;
if (arena)
thd->restore_active_arena(arena, &backup);
@ -625,13 +626,26 @@ JOIN::optimize()
DBUG_RETURN(1);
}
if (cond_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */
DBUG_PRINT("info", ("Impossible WHERE"));
zero_result_cause= "Impossible WHERE";
error= 0;
DBUG_RETURN(0);
{
Item::cond_result having_value;
having= optimize_cond(thd, having, &having_value);
if (thd->net.report_error)
{
error= 1;
DBUG_PRINT("error",("Error from optimize_cond"));
DBUG_RETURN(1);
}
if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */
DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
"Impossible HAVING" : "Impossible WHERE"));
zero_result_cause= ?
"Impossible HAVING" : "Impossible WHERE";
error= 0;
DBUG_RETURN(0);
}
}
/* Optimize count(*), min() and max() */