diff options
author | unknown <svoj@mysql.com/april.(none)> | 2006-12-20 19:05:35 +0400 |
---|---|---|
committer | unknown <svoj@mysql.com/april.(none)> | 2006-12-20 19:05:35 +0400 |
commit | 9d85b0a61673eea742c0fa84c9bafb5cc620e4fd (patch) | |
tree | c11e97770dd6f5a74395241a416cb6c76d6744cb /mysql-test/r | |
parent | 2576c4c0c90d00348c1bb17fa1a6f76e6e3988f3 (diff) | |
download | mariadb-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 'mysql-test/r')
-rw-r--r-- | mysql-test/r/myisam.result | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index b34c127595f..73cee4835bf 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -944,3 +944,19 @@ select * from t1; a 42 drop table t1; +CREATE TABLE t1(a VARCHAR(16)); +INSERT INTO t1 VALUES('aaaaaaaa'),(NULL); +UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa'; +SELECT * FROM t1; +a +aaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1),(2); +UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1; +SELECT * FROM t1 ORDER BY a; +a +2 +3 +DROP TABLE t1; |