summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-07-14 15:13:36 +0000
committerunknown <sergefp@mysql.com>2005-07-14 15:13:36 +0000
commitd91c901f617ddfeade701476d9d050247a905ed3 (patch)
tree9405985d622fdb5e1dede6bee87fb3fec954495f /sql/sql_select.cc
parentecd1ea93a7ec01dddfc11a2a3b5c69f780965837 (diff)
downloadmariadb-git-d91c901f617ddfeade701476d9d050247a905ed3.tar.gz
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. mysql-test/r/select.result: Testcase for BUG#11700 mysql-test/t/select.test: Testcase for BUG#11700
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 972fb4e0368..75fc189b21f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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);