From f6cac54bf6598b2063a2cb1477994f22e86e78f6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Dec 2005 19:52:26 +0100 Subject: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. INSERT ... SELECT with the same table on both sides (hidden below a MERGE table) does now work by buffering the select result. The duplicate detection works now after open_and_lock_tables() on the locks. I did not find a test case that failed without the change in sql_update.cc. I made the change anyway as it should in theory fix a possible MERGE table problem with multi-table update. libmysqld/ha_blackhole.cc: BUG#5390 - problems with merge tables No idea, how the symlink change made it into my patch. mysql-test/r/create.result: BUG#5390 - problems with merge tables Removed a duplicate test. mysql-test/r/merge.result: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. Added test results. mysql-test/t/create.test: BUG#5390 - problems with merge tables Removed a duplicate test. mysql-test/t/merge.test: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. Added tests. sql/lock.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. Added a new function to find a duplicate lock in a list of tables. sql/mysql_priv.h: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. Added a declaration for the new function. sql/sql_parse.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. Changed the duplicate tables detection for INSERT ... SELECT to use the new function, which does also work for MERGE tables. sql/sql_update.cc: BUG#5390 - problems with merge tables Problem #1: INSERT...SELECT, Version for 4.1. Changed the duplicate tables detection for UPDATE to use the new function, which does also work for MERGE tables. --- mysql-test/t/merge.test | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mysql-test/t/merge.test') diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index d384c017611..a723443b395 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -350,4 +350,30 @@ INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=3; SELECT b FROM t2; DROP TABLE t1, t2; + +# +# BUG#5390 - problems with merge tables +# Problem #1: INSERT...SELECT +# +#drop table if exists t1, t2, t3; +create table t1(a int); +create table t2(a int); +insert into t1 values (1); +insert into t2 values (2); +create table t3 (a int) engine=merge union=(t1, t2) insert_method=first; +select * from t3; +# +insert t2 select * from t2; +select * from t2; +# +insert t3 select * from t1; +select * from t3; +# +insert t1 select * from t3; +select * from t1; +select * from t2; +select * from t3; +check table t1, t2; +drop table t1, t2, t3; + # End of 4.1 tests -- cgit v1.2.1