summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/april.(none)>2006-12-20 19:05:35 +0400
committerunknown <svoj@mysql.com/april.(none)>2006-12-20 19:05:35 +0400
commit9d85b0a61673eea742c0fa84c9bafb5cc620e4fd (patch)
treec11e97770dd6f5a74395241a416cb6c76d6744cb /sql/lock.cc
parent2576c4c0c90d00348c1bb17fa1a6f76e6e3988f3 (diff)
downloadmariadb-git-9d85b0a61673eea742c0fa84c9bafb5cc620e4fd.tar.gz
BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage engine
An update that used a join of a table to itself and modified the table on one side of the join reported the table as crashed or updated wrong rows. Fixed by creating temporary table for self-joined multi update statement. mysql-test/r/myisam.result: A test case for BUG#21310. mysql-test/t/myisam.test: A test case for BUG#21310. sql/lock.cc: Exclude 'table' param from check. sql/sql_update.cc: Disabling record cache for self-joined multi update statement is wrong. The join must only see the table as it was at the beginning of the statement. safe_update_on_fly check if it is safe to update first table on the fly, that is not creating temporary table. It is possible in case a row from this table is never read more than once. safe_update_on_fly now detect self-joined table and refuse to update this table on the fly.
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index ab4a81034ba..3b2b2857f65 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -528,7 +528,7 @@ int mysql_lock_have_duplicate(THD *thd, TABLE *table, TABLE_LIST *tables)
for (; tables; tables= tables->next)
{
table2= tables->table;
- if (table2->tmp_table == TMP_TABLE)
+ if (table2->tmp_table == TMP_TABLE || table == table2)
continue;
/* All tables in list must be in lock. */