summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2013-01-31 09:13:42 +0400
committerGleb Shchepa <gleb.shchepa@oracle.com>2013-01-31 09:13:42 +0400
commit4743ba00bbe8e314230a98fba153271816459ba4 (patch)
tree988c67022a5a8af1b1136f0071a5bd19314a3a73 /sql/item_cmpfunc.cc
parentf57cba0ca0431edc9af7931d39067ed2c55572c2 (diff)
parent2993c299d7b65beec7d4fbeec8b981c6a4795694 (diff)
downloadmariadb-git-4743ba00bbe8e314230a98fba153271816459ba4.tar.gz
Bug #11827369: ASSERTION FAILED: !THD->LEX->CONTEXT_ANALYSIS_ONLY
Manual up-merge from 5.1 to 5.5.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 4dc41d29794..32b1ae4914a 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -4366,7 +4366,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
const_item_cache= FALSE;
}
with_sum_func= with_sum_func || item->with_sum_func;
- with_subselect|= item->with_subselect;
+ with_subselect|= item->has_subquery();
if (item->maybe_null)
maybe_null=1;
}
@@ -4691,7 +4691,7 @@ longlong Item_func_isnull::val_int()
Handle optimization if the argument can't be null
This has to be here because of the test in update_used_tables().
*/
- if (!used_tables_cache && !with_subselect)
+ if (const_item_cache)
return cached_value;
return args[0]->is_null() ? 1: 0;
}
@@ -4700,7 +4700,7 @@ longlong Item_is_not_null_test::val_int()
{
DBUG_ASSERT(fixed == 1);
DBUG_ENTER("Item_is_not_null_test::val_int");
- if (!used_tables_cache && !with_subselect)
+ if (const_item_cache)
{
owner->was_null|= (!cached_value);
DBUG_PRINT("info", ("cached: %ld", (long) cached_value));
@@ -4721,10 +4721,12 @@ longlong Item_is_not_null_test::val_int()
*/
void Item_is_not_null_test::update_used_tables()
{
+ const_item_cache= false;
if (!args[0]->maybe_null)
{
used_tables_cache= 0; /* is always true */
cached_value= (longlong) 1;
+ const_item_cache= true;
}
else
{
@@ -4733,6 +4735,7 @@ void Item_is_not_null_test::update_used_tables()
{
/* Remember if the value is always NULL or never NULL */
cached_value= (longlong) !args[0]->is_null();
+ const_item_cache= true;
}
}
}
@@ -4986,6 +4989,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
args[1]->fix_fields(thd, args + 1)) || args[1]->check_cols(1))
return TRUE; /* purecov: inspected */
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
+ with_subselect= args[0]->has_subquery() || args[1]->has_subquery();
max_length= 1;
decimals= 0;