summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-11 09:53:42 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-11 09:53:42 +0100
commit2f20d297f8ea731d845bb220e680ad10c7a927bc (patch)
tree9bd18ef1ab766422ba4c51b4ab189e259955a2d0 /sql/item_cmpfunc.h
parenta629b5172e96c96c414fca70fffd64c80f2f7e8f (diff)
parenteb4f2e063c341d9f3644339c68cb01679e782001 (diff)
downloadmariadb-git-2f20d297f8ea731d845bb220e680ad10c7a927bc.tar.gz
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r--sql/item_cmpfunc.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 9149f25b1b1..625af3231fc 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1676,10 +1676,26 @@ public:
update_used_tables();
}
const char *func_name() const { return "isnull"; }
+
+ bool arg_is_datetime_notnull_field()
+ {
+ Item **args= arguments();
+ if (args[0]->type() == Item::FIELD_ITEM)
+ {
+ Field *field=((Item_field*) args[0])->field;
+
+ if (((field->type() == MYSQL_TYPE_DATE) ||
+ (field->type() == MYSQL_TYPE_DATETIME)) &&
+ (field->flags & NOT_NULL_FLAG))
+ return true;
+ }
+ return false;
+ }
+
/* Optimize case of not_null_column IS NULL */
virtual void update_used_tables()
{
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null && !arg_is_datetime_notnull_field())
{
used_tables_cache= 0; /* is always false */
const_item_cache= 1;