mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Fix for bug #24117 "server crash on a FETCH with a cursor on a table which is not in the table cache"
Problem: When creating a temporary field for a temporary table in create_tmp_field_from_field(), a resulting field is created as an exact copy of an original one (in Field::new_field()). However, Field_enum and Field_set contain a pointer (typelib) to memory allocated in the parent table's MEM_ROOT, which under some circumstances may be deallocated later by the time a temporary table is used. Solution: Override the new_field() method for Field_enum and Field_set and create a separate copy of the typelib structure in there.
This commit is contained in:
@@ -1277,6 +1277,7 @@ public:
|
||||
{
|
||||
flags|=ENUM_FLAG;
|
||||
}
|
||||
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
|
||||
enum_field_types type() const { return FIELD_TYPE_STRING; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum Item_result cast_to_int_type () const { return INT_RESULT; }
|
||||
|
||||
Reference in New Issue
Block a user