2 # Test of update statement that uses many tables.
6 # If we are running with
7 # - Valgrind -> $VALGRIND_TEST <> 0
8 # - debug tracing -> @@session.debug LIKE '%trace%'
9 # the resource consumption (storage space needed, runtime) will be extreme.
10 # Therefore we require that the option "--big-test" is also set.
15 --error 0,ER_UNKNOWN_SYSTEM_VARIABLE
16 SET @aux = @@session.debug;
19 # We have returncode 0 = the server system variable @@session.debug exists.
20 # But we only need "--big-test" in case of tracing.
21 if (`SELECT @@session.debug LIKE '%trace%'`)
29 # We are running with Valgrind
32 if (`SELECT '$BIG_TEST' = '' AND $need_big = 1`)
34 --skip Need "--big-test" when running with the option "--debug" or "--valgrind"
38 # Bug#1820 Rows not deleted from second table on multi-table delete
42 DROP TABLE IF EXISTS t1,t2;
45 CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
46 --echo # The protocolling of many inserts into t1 is suppressed.
48 INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
53 eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
59 ALTER TABLE t1 ADD INDEX i1(a);
60 DELETE FROM t1 WHERE a > 2000000;
61 CREATE TABLE t2 LIKE t1;
62 INSERT INTO t2 SELECT * FROM t1;
64 SELECT 't2 rows before small delete', COUNT(*) FROM t1;
65 DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
66 SELECT 't2 rows after small delete', COUNT(*) FROM t2;
67 SELECT 't1 rows after small delete', COUNT(*) FROM t1;
69 ## Try deleting many rows
71 DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
72 SELECT 't2 rows after big delete', COUNT(*) FROM t2;
73 SELECT 't1 rows after big delete', COUNT(*) FROM t1;