mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt BitKeeper/etc/ignore: auto-union client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/mysql_com.h: Auto merged libmysql/CMakeLists.txt: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/archive.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/delayed.result: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/suite/rpl/r/rpl_innodb_bug28430.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/func_misc.test: Auto merged mysql-test/t/information_schema.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/queues.c: Auto merged sql/events.cc: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_partition.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_open.c: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/lib/mtr_report.pl: manual merge mysql-test/r/myisam.result: manual merge mysql-test/r/partition.result: manual merge mysql-test/r/user_var.result: manual merge mysql-test/t/myisam.test: manual merge mysql-test/t/partition.test: manual merge mysql-test/t/user_var.test: manual merge sql/item.h: manual merge sql/item_func.cc: manual merge storage/myisammrg/ha_myisammrg.cc: manual merge
This commit is contained in:
@@ -223,6 +223,7 @@ static void select_describe(JOIN *join, bool need_tmp_table,bool need_order,
|
||||
bool distinct, const char *message=NullS);
|
||||
static Item *remove_additional_cond(Item* conds);
|
||||
static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab);
|
||||
static bool test_if_ref(Item_field *left_item,Item *right_item);
|
||||
|
||||
|
||||
/*
|
||||
@@ -680,9 +681,6 @@ err:
|
||||
without "checking NULL", remove the predicates that were pushed down
|
||||
into the subquery.
|
||||
|
||||
We can remove the equalities that will be guaranteed to be true by the
|
||||
fact that subquery engine will be using index lookup.
|
||||
|
||||
If the subquery compares scalar values, we can remove the condition that
|
||||
was wrapped into trig_cond (it will be checked when needed by the subquery
|
||||
engine)
|
||||
@@ -692,6 +690,12 @@ err:
|
||||
and non-NULL values, we'll do a full table scan and will rely on the
|
||||
equalities corresponding to non-NULL parts of left tuple to filter out
|
||||
non-matching records.
|
||||
|
||||
TODO: We can remove the equalities that will be guaranteed to be true by the
|
||||
fact that subquery engine will be using index lookup. This must be done only
|
||||
for cases where there are no conversion errors of significance, e.g. 257
|
||||
that is searched in a byte. But this requires homogenization of the return
|
||||
codes of all Field*::store() methods.
|
||||
*/
|
||||
|
||||
void JOIN::remove_subq_pushed_predicates(Item **where)
|
||||
@@ -699,17 +703,13 @@ void JOIN::remove_subq_pushed_predicates(Item **where)
|
||||
if (conds->type() == Item::FUNC_ITEM &&
|
||||
((Item_func *)this->conds)->functype() == Item_func::EQ_FUNC &&
|
||||
((Item_func *)conds)->arguments()[0]->type() == Item::REF_ITEM &&
|
||||
((Item_func *)conds)->arguments()[1]->type() == Item::FIELD_ITEM)
|
||||
((Item_func *)conds)->arguments()[1]->type() == Item::FIELD_ITEM &&
|
||||
test_if_ref ((Item_field *)((Item_func *)conds)->arguments()[1],
|
||||
((Item_func *)conds)->arguments()[0]))
|
||||
{
|
||||
*where= 0;
|
||||
return;
|
||||
}
|
||||
if (conds->type() == Item::COND_ITEM &&
|
||||
((class Item_func *)this->conds)->functype() ==
|
||||
Item_func::COND_AND_FUNC)
|
||||
{
|
||||
*where= remove_additional_cond(conds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1259,7 +1259,7 @@ JOIN::optimize()
|
||||
{
|
||||
if (!having)
|
||||
{
|
||||
Item *where= 0;
|
||||
Item *where= conds;
|
||||
if (join_tab[0].type == JT_EQ_REF &&
|
||||
join_tab[0].ref.items[0]->name == in_left_expr_name)
|
||||
{
|
||||
@@ -2366,6 +2366,11 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
|
||||
{
|
||||
int error;
|
||||
DBUG_ENTER("get_quick_record_count");
|
||||
#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
|
||||
uchar buff[STACK_BUFF_ALLOC];
|
||||
#endif
|
||||
if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
|
||||
DBUG_RETURN(0); // Fatal error flag is set
|
||||
if (select)
|
||||
{
|
||||
select->head=table;
|
||||
@@ -10619,7 +10624,8 @@ Next_select_func setup_end_select_func(JOIN *join)
|
||||
/* Set up select_end */
|
||||
if (table)
|
||||
{
|
||||
if (table->group && tmp_tbl->sum_func_count)
|
||||
if (table->group && tmp_tbl->sum_func_count &&
|
||||
!tmp_tbl->precomputed_group_by)
|
||||
{
|
||||
if (table->s->keys)
|
||||
{
|
||||
@@ -12260,8 +12266,12 @@ static bool test_if_ref(Item_field *left_item,Item *right_item)
|
||||
Item *ref_item=part_of_refkey(field->table,field);
|
||||
if (ref_item && ref_item->eq(right_item,1))
|
||||
{
|
||||
right_item= right_item->real_item();
|
||||
if (right_item->type() == Item::FIELD_ITEM)
|
||||
return (field->eq_def(((Item_field *) right_item)->field));
|
||||
/* remove equalities injected by IN->EXISTS transformation */
|
||||
else if (right_item->type() == Item::CACHE_ITEM)
|
||||
return ((Item_cache *)right_item)->eq_def (field);
|
||||
if (right_item->const_item() && !(right_item->is_null()))
|
||||
{
|
||||
/*
|
||||
@@ -15969,7 +15979,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
||||
{
|
||||
if (tab->use_quick == 2)
|
||||
{
|
||||
char buf[MAX_KEY/8+1];
|
||||
/* 4 bits per 1 hex digit + terminating '\0' */
|
||||
char buf[MAX_KEY / 4 + 1];
|
||||
extra.append(STRING_WITH_LEN("; Range checked for each "
|
||||
"record (index map: 0x"));
|
||||
extra.append(tab->keys.print(buf));
|
||||
|
||||
Reference in New Issue
Block a user