diff options
author | dlenev@mysql.com <> | 2006-03-29 14:53:00 +0400 |
---|---|---|
committer | dlenev@mysql.com <> | 2006-03-29 14:53:00 +0400 |
commit | 17785d169bdc4e75151469a0b101378dd49524d2 (patch) | |
tree | 6f6da109cd3a4c650e3a8bc44c60c6d773cefcd0 /sql/sql_load.cc | |
parent | 659710e29c769d0c80620991b788999135032b51 (diff) | |
download | mariadb-git-17785d169bdc4e75151469a0b101378dd49524d2.tar.gz |
Proposed fix for bug #17764 "Trigger crashes MyISAM table"
A table with an on insert trigger was reported as crashed when the insert
was processed with bulk insert mode on (handler::start_bulk_insert).
The trigger was also selecting from the same table, and that caused
the "crash".
The same problem was present when an insert statement, which was processed
in bulk mode, also used a stored function that was reading the same table.
This fix disables bulk inserts if a statement uses functions or invokes
triggers. Implementing more granular checks will require much more code and
therefore can hardly be done in 5.0
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r-- | sql/sql_load.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc index cc724c102a4..0a667c887ef 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -356,7 +356,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (ignore || handle_duplicates == DUP_REPLACE) table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); - table->file->start_bulk_insert((ha_rows) 0); + if (!thd->prelocked_mode) + table->file->start_bulk_insert((ha_rows) 0); table->copy_blobs=1; thd->no_trans_update= 0; @@ -373,7 +374,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, error= read_sep_field(thd, info, table_list, fields_vars, set_fields, set_values, read_info, *enclosed, skip_lines, ignore); - if (table->file->end_bulk_insert() && !error) + if (!thd->prelocked_mode && table->file->end_bulk_insert() && !error) { table->file->print_error(my_errno, MYF(0)); error= 1; |