From c18054deb2b5cfcf1f13aa71574406f2bafb87c6 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 2 Nov 2016 08:20:15 +0400 Subject: MDEV-10347 mysqld got signal 11 --- sql/item_cmpfunc.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 2e066b895e9..9a9d0e65ff6 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1022,6 +1022,11 @@ public: Item_func_hybrid_field_type(thd, a, b, a), m_cache(NULL) { arg_count--; } + void cleanup() + { + Item_func_hybrid_field_type::cleanup(); + arg_count= 2; // See the comment to the constructor + } bool date_op(MYSQL_TIME *ltime, uint fuzzydate); double real_op(); longlong int_op(); -- cgit v1.2.1 From f0d8a4d29e3dbd713dc13fb052acd0a96ab47522 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 3 Nov 2016 22:02:24 +0400 Subject: MDEV-11219 main.null fails in buldbot and outside with ps-protocol --- sql/item_cmpfunc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 9a9d0e65ff6..9149f25b1b1 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1009,6 +1009,7 @@ class Item_func_nullif :public Item_func_hybrid_field_type */ Item_cache *m_cache; int compare(); + Item *m_arg0; public: /* Here we pass three arguments to the parent constructor, as NULLIF @@ -1020,7 +1021,8 @@ public: */ Item_func_nullif(THD *thd, Item *a, Item *b): Item_func_hybrid_field_type(thd, a, b, a), - m_cache(NULL) + m_cache(NULL), + m_arg0(NULL) { arg_count--; } void cleanup() { -- cgit v1.2.1 From 748d993cca6c63d40236ac7c937630965283242d Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Tue, 29 Nov 2016 11:28:15 -0800 Subject: Fixed bug mdev-11364. The function Item_func_isnull::update_used_tables() must handle the case when the predicate is over not nullable column in a special way. This is actually a bug of MariaDB 5.3/5.5, but it's probably hard to demonstrate that it can cause problems there. --- sql/item_cmpfunc.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'sql/item_cmpfunc.h') diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index dbd96a89a24..9e83b732dc7 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1387,10 +1387,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; -- cgit v1.2.1