Merged fix for the bug#37870.
This commit is contained in:
commit
6e0c62fd6c
@ -413,11 +413,11 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
|
|||||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
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.
|
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();
|
orig_field_val= field->val_int();
|
||||||
if (!(*item)->is_null() && !(*item)->save_in_field(field, 1))
|
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
|
result= 1; // Item was replaced
|
||||||
}
|
}
|
||||||
/* Restore the original field value. */
|
/* 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);
|
result= field->store(orig_field_val, TRUE);
|
||||||
/* orig_field_val must be a valid value that can be restored back. */
|
/* orig_field_val must be a valid value that can be restored back. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user