diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-09-07 07:44:54 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-09-07 07:44:54 +0400 |
commit | 8750df43ab94fb63c1f628b72e89e15118eb7431 (patch) | |
tree | dad04ad932cf21f2c6d057a130d76998ba2cdec5 /sql/item_func.cc | |
parent | 39e5b76ef1e68c0aed0b0f6941d517a986fe8821 (diff) | |
download | mariadb-git-8750df43ab94fb63c1f628b72e89e15118eb7431.tar.gz |
MDEV-20517 Assertion `!is_expensive()' failed in Item::value_depends_on_sql_mode_const_item
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index d11b56f2aad..5deeccc9265 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1423,17 +1423,22 @@ bool Item_func_minus::fix_length_and_dec() { if (Item_num_op::fix_length_and_dec()) return TRUE; - m_sql_mode_dependency= Item_func::value_depends_on_sql_mode(); - if (unsigned_flag) - { - m_sql_mode_dependency|= Sql_mode_dependency(0,MODE_NO_UNSIGNED_SUBTRACTION); - if (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION) - unsigned_flag= false; - } + if ((m_depends_on_sql_mode_no_unsigned_subtraction= unsigned_flag) && + (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION)) + unsigned_flag= false; return FALSE; } +Sql_mode_dependency Item_func_minus::value_depends_on_sql_mode() const +{ + Sql_mode_dependency dep= Item_func_additive_op::value_depends_on_sql_mode(); + if (m_depends_on_sql_mode_no_unsigned_subtraction) + dep|= Sql_mode_dependency(0, MODE_NO_UNSIGNED_SUBTRACTION); + return dep; +} + + double Item_func_minus::real_op() { double value= args[0]->val_real() - args[1]->val_real(); |