1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for BUG#11700: in add_not_null_conds(), call full fix_fields() for the created NOT NULL.

This is needed because in some cases range optimization is performed twice and added 
  NOT NULL item must have correct const_table_map() value.
This commit is contained in:
sergefp@mysql.com
2005-07-14 15:13:36 +00:00
parent 1826c39897
commit e1273aec6d
3 changed files with 85 additions and 3 deletions

View File

@ -3539,11 +3539,17 @@ static void add_not_null_conds(JOIN *join)
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *not_null_item= (Item_field*)item;
JOIN_TAB *referred_tab= not_null_item->field->table->reginfo.join_tab;
Item_func_isnotnull *notnull;
Item *notnull;
if (!(notnull= new Item_func_isnotnull(not_null_item)))
DBUG_VOID_RETURN;
notnull->quick_fix_field();
/*
We need to do full fix_fields() call here in order to have correct
notnull->const_item(). This is needed e.g. by test_quick_select
when it is called from make_join_select after this function is
called.
*/
if (notnull->fix_fields(join->thd, join->tables_list, &notnull))
DBUG_VOID_RETURN;
DBUG_EXECUTE("where",print_where(notnull,
referred_tab->table->table_name););
add_cond_and_fix(&referred_tab->select_cond, notnull);