diff options
author | unknown <ingo@mysql.com> | 2006-06-26 20:57:18 +0200 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2006-06-26 20:57:18 +0200 |
commit | ab5ebc0fb7ce9e6af5bf3ac25425d518ee1a1050 (patch) | |
tree | 8da796375c26892a4d0fc40f0c972bc38af0ec72 /sql/sql_select.cc | |
parent | 8efe592d58f657800c7c4e00f2c85815f7ae03d8 (diff) | |
download | mariadb-git-ab5ebc0fb7ce9e6af5bf3ac25425d518ee1a1050.tar.gz |
Bug#16218 - Crash on insert delayed
Bug#17294 - INSERT DELAYED puting an \n before data
Bug#16611 - INSERT DELAYED corrupts data
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
INSERT DELAYED crashed in 5.0 on a table with a varchar that
could be NULL and was created pre-5.0 (Bugs 16218 and 13707).
INSERT DELAYED corrupted data in 5.0 on a table with varchar
fields that was created pre-5.0 (Bugs 17294 and 16611).
In case of INSERT DELAYED the open table is copied from the
delayed insert thread to be able to create a record for the
queue. When copying the fields, a method was used that did
convert old varchar to new varchar fields and did not set up
some pointers into the record buffer of the table.
The field conversion was guilty for the misinterpretation of
the record contents by the delayed insert thread. The wrong
pointer setup was guilty for the crashes.
For Bug 13707 (Server crash with INSERT DELAYED on MyISAM table)
I fixed the above mentioned method to set up one of the pointers.
For Bug 16218 I set up the other pointers too.
But when looking at the corruptions I got aware that converting
the field type was totally wrong for INSERT DELAYED. The copied
table is used to create a record that is to be sent to the
delayed insert thread. Of course it can interpret the record
correctly only if all field types are the same in both table
objects.
So I revoked the fix for Bug 13707 and changed the new_field()
method so that it can suppress conversions.
No test case as this is a migration problem. One needs to
create a table with 4.x and use it with 5.x. I added two
test scripts to the bug report.
sql/field.cc:
Bug#16218 - Crash on insert delayed
Bug#17294 - INSERT DELAYED puting an \n before data
Bug#16611 - INSERT DELAYED corrupts data
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
Added parameter 'keep_type' to Field::new_field().
Undid the change from Bug 13707 (Server crash with INSERT
DELAYED on MyISAM table).
I solved all four bugs in sql/sql_insert.cc by making exact
duplicates of the fields. The new_field() method converts
certain field types, which is wrong for INSERT DELAYED.
sql/field.h:
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
Added parameter 'keep_type' to Field::new_field().
sql/sql_insert.cc:
Bug#16218 - Crash on insert delayed
Bug#17294 - INSERT DELAYED puting an \n before data
Bug#16611 - INSERT DELAYED corrupts data
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
Added comments. Made small style fixes.
Used the new parameter 'keep_type' of Field::new_field()
to avoid field type conversion. The table copy must have
exactly the same types of fields as the original table.
Otherwise the record contents created by the foreground
thread could be misinterpreted by the delayed insert thread.
sql/sql_select.cc:
Bug#16218 - Crash on insert delayed
Bug#17294 - INSERT DELAYED puting an \n before data
Bug#16611 - INSERT DELAYED corrupts data
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
Added parameter 'keep_type' to Field::new_field().
Undid the change from Bug 13707 (Server crash with INSERT
DELAYED on MyISAM table).
I solved all four bugs in sql/sql_insert.cc by making exact
duplicates of the fields. The new_field() method converts
certain field types, which is wrong for INSERT DELAYED.
sql/sql_trigger.cc:
Bug#16218 - Crash on insert delayed
Bug#17294 - INSERT DELAYED puting an \n before data
Bug#16611 - INSERT DELAYED corrupts data
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
Added parameter 'keep_type' to Field::new_field().
Undid the change from Bug 13707 (Server crash with INSERT
DELAYED on MyISAM table).
I solved all four bugs in sql/sql_insert.cc by making exact
duplicates of the fields. The new_field() method converts
certain field types, which is wrong for INSERT DELAYED.
sql/table.cc:
Bug#16218 - Crash on insert delayed
Bug#17294 - INSERT DELAYED puting an \n before data
Bug#16611 - INSERT DELAYED corrupts data
Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Combined as Bug#16218.
Added parameter 'keep_type' to Field::new_field().
Undid the change from Bug 13707 (Server crash with INSERT
DELAYED on MyISAM table).
I solved all four bugs in sql/sql_insert.cc by making exact
duplicates of the fields. The new_field() method converts
certain field types, which is wrong for INSERT DELAYED.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 465f41fa8de..d25f1291a7b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8217,7 +8217,8 @@ Field* create_tmp_field_from_field(THD *thd, Field* org_field, org_field->field_name, table, org_field->charset()); else - new_field= org_field->new_field(thd->mem_root, table); + new_field= org_field->new_field(thd->mem_root, table, + table == org_field->table); if (new_field) { if (item) @@ -13072,7 +13073,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, saved value */ Field *field= item->field; - item->result_field=field->new_field(thd->mem_root,field->table); + item->result_field=field->new_field(thd->mem_root,field->table, 1); char *tmp=(char*) sql_alloc(field->pack_length()+1); if (!tmp) goto err; |