-
unknown authored
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. include/typelib.h: Added copy_typelib() declaration mysql-test/r/sp.result: Added a testcase for bug #24117 "server crash on a FETCH with a cursor on a table which is not in the table cache" mysql-test/t/sp.test: Added a testcase for bug #24117 "server crash on a FETCH with a cursor on a table which is not in the table cache" mysys/typelib.c: Added copy_typelib() definition sql/field.cc: Create a copy of the internal 'typelib' structure when copying Field_enum of Field_set objects. sql/field.h: Override new_field method in Field_enum (and Field_set) to copy the typelib structure.
5b712814