diff options
author | unknown <kaa@polly.local> | 2006-12-14 20:58:07 +0300 |
---|---|---|
committer | unknown <kaa@polly.local> | 2006-12-14 20:58:07 +0300 |
commit | 5b71281467c85dc705da30f0fe4ebc094f0ff983 (patch) | |
tree | ead3becc168cb944b0829362acb6113451102675 /mysql-test/r/sp.result | |
parent | 66e49e3763c90cf169af6f8710786be6176ee5b6 (diff) | |
download | mariadb-git-5b71281467c85dc705da30f0fe4ebc094f0ff983.tar.gz |
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.
Diffstat (limited to 'mysql-test/r/sp.result')
-rw-r--r-- | mysql-test/r/sp.result | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 9db4325aea2..793abb417fb 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5708,4 +5708,20 @@ DROP TABLE bug23760, bug23760_log| DROP PROCEDURE bug23760_update_log| DROP PROCEDURE bug23760_test_row_count| DROP FUNCTION bug23760_rc_test| +DROP PROCEDURE IF EXISTS bug24117| +DROP TABLE IF EXISTS t3| +CREATE TABLE t3(c1 ENUM('abc'))| +INSERT INTO t3 VALUES('abc')| +CREATE PROCEDURE bug24117() +BEGIN +DECLARE t3c1 ENUM('abc'); +DECLARE mycursor CURSOR FOR SELECT c1 FROM t3; +OPEN mycursor; +FLUSH TABLES; +FETCH mycursor INTO t3c1; +CLOSE mycursor; +END| +CALL bug24117()| +DROP PROCEDURE bug24117| +DROP TABLE t3| drop table t1,t2; |