diff options
author | Evgeny Potemkin <epotemkin@mysql.com> | 2008-10-27 19:19:26 +0300 |
---|---|---|
committer | Evgeny Potemkin <epotemkin@mysql.com> | 2008-10-27 19:19:26 +0300 |
commit | 545e4c58b273ca7eadfcfe52a3ac5885cabf5798 (patch) | |
tree | d5778d87e07f132a05c379c0cf38520dc7a77b0c /sql/item_cmpfunc.cc | |
parent | e27e56078388c2005b46073b5b295edcba79f359 (diff) | |
download | mariadb-git-545e4c58b273ca7eadfcfe52a3ac5885cabf5798.tar.gz |
Corrected fix for the bug#37870.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0c95336251b..cefa479fea6 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -413,11 +413,11 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* - Store the value of the field if it references an outer field because + Store the value of the field/constant if it references an outer field because the call to save_in_field below overrides that value. - Don't store it for EXPLAIN since it's not initialized. + Don't save value of the field for EXPLAIN since it's not initialized. */ - if (field_item->depended_from && !thd->lex->describe) + if (field_item->depended_from && (!thd->lex->describe || field_item->const_item())) orig_field_val= field->val_int(); if (!(*item)->is_null() && !(*item)->save_in_field(field, 1)) { @@ -428,7 +428,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item, result= 1; // Item was replaced } /* Restore the original field value. */ - if (field_item->depended_from && !thd->lex->describe) + if (field_item->depended_from && (!thd->lex->describe || field_item->const_item())) { result= field->store(orig_field_val, TRUE); /* orig_field_val must be a valid value that can be restored back. */ |