mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-24958 Server crashes in my_strtod ... with DEFAULT(blob)
Fixes also: MDEV-24942 Server crashes in _ma_rec_pack... with DEFAULT() on BLOB This was caused by two different bugs, both related to that the default value for the blob was not calculated before it was used: - There where now Item_default_value::..result() wrappers, which is needed as item in HAVING uses these. This causes crashes when using a reference to a DEFAULT(blob_field) in HAVING. It also caused wrong results when used with other fields with default value expressions that are not constants. - create_tmp_field() did not take into account that blob fields with default expressions are not yet initialized. Fixed by treating Item_default_value(blob) like a normal item expression.
This commit is contained in:
@ -17224,7 +17224,13 @@ Field *Item::create_field_for_schema(THD *thd, TABLE *table)
|
||||
the record in the original table.
|
||||
If modify_item is 0 then fill_record() will update
|
||||
the temporary table
|
||||
|
||||
@param table_cant_handle_bit_fields
|
||||
Set to 1 if the temporary table cannot handle bit
|
||||
fields. Only set for heap tables when the bit field
|
||||
is part of an index.
|
||||
@param make_copy_field
|
||||
Set when using with rollup when we want to have
|
||||
an exact copy of the field.
|
||||
@retval
|
||||
0 on error
|
||||
@retval
|
||||
@ -17261,8 +17267,22 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
|
||||
return result;
|
||||
}
|
||||
case Item::FIELD_ITEM:
|
||||
case Item::DEFAULT_VALUE_ITEM:
|
||||
{
|
||||
Field *field= ((Item_default_value*) item)->field;
|
||||
if (field->default_value && (field->flags & BLOB_FLAG))
|
||||
{
|
||||
/*
|
||||
We have to use a copy function when using a blob with default value
|
||||
as the we have to calcuate the default value before we can use it.
|
||||
*/
|
||||
return create_tmp_field_from_item(thd, item, table,
|
||||
(make_copy_field ? 0 : copy_func),
|
||||
modify_item);
|
||||
}
|
||||
}
|
||||
/* Fall through */
|
||||
case Item::FIELD_ITEM:
|
||||
case Item::CONTEXTUALLY_TYPED_VALUE_ITEM:
|
||||
case Item::INSERT_VALUE_ITEM:
|
||||
case Item::TRIGGER_FIELD_ITEM:
|
||||
|
Reference in New Issue
Block a user