summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/optimizer_unfixed_bugs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/optimizer_unfixed_bugs
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/optimizer_unfixed_bugs')
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/README.txt29
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/disabled.def2
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result11
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result17
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result40
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result0
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result1110
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result1110
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result0
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result1107
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result1107
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result0
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result984
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result984
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result0
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result984
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result984
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result10
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result256
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result31
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result13
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result46
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result32
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result104
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result51
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result158
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result108
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result39
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test16
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test23
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt1
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test44
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test489
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test488
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test486
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test486
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test363
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test363
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test363
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test363
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test16
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test250
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test41
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test19
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test46
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test63
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test87
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test49
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test183
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test97
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test34
51 files changed, 13687 insertions, 0 deletions
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/README.txt b/mysql-test/suite/optimizer_unfixed_bugs/README.txt
new file mode 100644
index 00000000..ddf65555
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/README.txt
@@ -0,0 +1,29 @@
+Putting testcases here
+~~~~~~~~~~~~~~~~~~~~~~
+
+When you work on re-verifying or re-classifying a bug (not fixing it),
+it's a good idea to put the mtr-parsable '.test' testcase here.
+Benefits:
+1) tests downloaded from the bugs db are sometimes close to
+mtr-parsable but not completely (for example if they contain
+/* comment */); when you re-verify or re-classify you run the test so
+may have to make it mtr-parsable; if you then put it in this suite,
+the developer who will work on this bug in a few weeks or months will
+not have to re-do the same download&fix, she/he can instead reuse your
+work.
+2) Others can see how their own work influences many unsolved
+bugs, by running this suite. If they find that they fix a bug in this
+suite, we won't later wonder "how come this bug doesn't happen
+anymore, what fixed it?".
+3) One can also run this suite with certain switches to see how they
+influence unsolved bugs:
+./mtr --suite=optimizer_unfixed_bugs \
+--mysqld=--optimizer_switch="firstmatch=off"
+
+Adding tests to this suite
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+One test file per bug, named bugNNNNN.test.
+Put the correct (not current and buggy) result file in r/, so that "[ pass ]"
+in mtr will mean that a bug looks like fixed.
+When you have fixed a bug, remove files from this suite.
+t/bug45219.test is an example.
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/disabled.def b/mysql-test/suite/optimizer_unfixed_bugs/disabled.def
new file mode 100644
index 00000000..148d19a9
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/disabled.def
@@ -0,0 +1,2 @@
+# Disabling all subquery problems
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result
new file mode 100644
index 00000000..a0be9e23
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result
@@ -0,0 +1,11 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+create table `t1` (`c1` char(1) default null,`c2` char(10) default null,
+key (`c1`))
+engine=innodb default charset=latin1;
+insert into `t1` values ('3',null);
+select * from `t1` where `c1`='3' for update;
+c1 c2
+3 NULL
+drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result
new file mode 100644
index 00000000..59ab7607
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result
@@ -0,0 +1,17 @@
+#
+# Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on
+#
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+CREATE TABLE t (
+dummy INT PRIMARY KEY,
+a INT UNIQUE,
+b int
+) ENGINE=InnoDB;
+INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5);
+SELECT * FROM t WHERE a > 2 FOR UPDATE;
+dummy a b
+3 3 3
+5 5 5
+DROP TABLE t;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result
new file mode 100644
index 00000000..eaad67de
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result
@@ -0,0 +1,40 @@
+select @default_binlog_format:=@@global.binlog_format;
+@default_binlog_format:=@@global.binlog_format
+MIXED
+set global binlog_format=row;
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
+set session debug_dbug="+d,optimizer_innodb_ds_mrr";
+set autocommit=0;
+use test;
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+create table t1 (dummy int primary key, a int unique, b int) engine=innodb;
+insert into t1 values(1,1,1),(3,3,3),(5,5,5);
+commit;
+set session transaction isolation level repeatable read;
+select @@tx_isolation;
+@@tx_isolation
+REPEATABLE-READ
+start transaction;
+select * from t1 where a > 2 for update;
+dummy a b
+3 3 3
+5 5 5
+connection con2;
+use test;
+set autocommit=0;
+start transaction;
+select 1;
+1
+1
+insert into t1 values(2,2,2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+rollback;
+connection con1;
+rollback;
+drop table t1;
+connection default;
+set global binlog_format=@default_binlog_format;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb-innodb.result
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result
new file mode 100644
index 00000000..96c8e1c6
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1-innodb.result
@@ -0,0 +1,1110 @@
+set @bug41996_extra1_tmp=@@optimizer_switch;
+set optimizer_switch='mrr=off';
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+set optimizer_switch=@bug41996_extra1_tmp;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result
new file mode 100644
index 00000000..ab24c2c1
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra1.result
@@ -0,0 +1,1110 @@
+set @bug41996_tmp=@@optimizer_switch;
+set optimizer_switch='mrr=off';
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+set optimizer_switch=@bug41996_tmp;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb-innodb.result
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result
new file mode 100644
index 00000000..58654984
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2-innodb.result
@@ -0,0 +1,1107 @@
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result
new file mode 100644
index 00000000..58654984
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra2.result
@@ -0,0 +1,1107 @@
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM d2.t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM d3.t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb-innodb.result
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result
new file mode 100644
index 00000000..4f9cbfb5
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3-innodb.result
@@ -0,0 +1,984 @@
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result
new file mode 100644
index 00000000..4f9cbfb5
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra3.result
@@ -0,0 +1,984 @@
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb-innodb.result
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result
new file mode 100644
index 00000000..0ff634de
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4-innodb.result
@@ -0,0 +1,984 @@
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result
new file mode 100644
index 00000000..0ff634de
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996-extra4.result
@@ -0,0 +1,984 @@
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+c1 c2
+3 3
+4 4
+5 5
+SELECT * FROM t2 ORDER BY c1;
+c1 c2
+12 1
+15 6
+SELECT * FROM t3 ORDER BY c1;
+c1 c2
+21 11
+22 11
+23 13
+24 14
+25 15
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result
new file mode 100644
index 00000000..acc18b06
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result
@@ -0,0 +1,10 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+drop table if exists `t1`;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb;
+insert into `t1` values(2,2);
+delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ;
+drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
new file mode 100644
index 00000000..40f505d8
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
@@ -0,0 +1,256 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `table5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `table5` (
+`col0` mediumtext,
+`col1` varchar(90) DEFAULT NULL,
+`col2` tinytext,
+`col3` time DEFAULT NULL,
+`col4` tinyint(1) DEFAULT NULL,
+`col5` tinytext,
+`col6` tinyint(1) DEFAULT NULL,
+`col7` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+`col8` tinyblob,
+`col9` tinyint(4) DEFAULT NULL,
+`col10` year(4) DEFAULT NULL,
+`col11` set('test1','test2','test3') DEFAULT NULL,
+`col12` text,
+`col13` char(248) DEFAULT NULL,
+`col14` bigint(20) DEFAULT NULL,
+`col15` text,
+`col16` tinyint(4) DEFAULT NULL,
+`col17` decimal(10,0) DEFAULT NULL,
+`col18` set('test1','test2','test3') DEFAULT NULL,
+`col19` varchar(255) DEFAULT NULL,
+`col20` float DEFAULT NULL,
+`col21` int(11) DEFAULT NULL,
+`col22` text,
+`col23` tinyint(1) DEFAULT NULL,
+`col24` decimal(10,0) NOT NULL DEFAULT '0',
+`col25` double DEFAULT NULL,
+`col26` float DEFAULT NULL,
+`col27` tinyblob,
+`col28` decimal(10,0) DEFAULT NULL,
+`col29` mediumblob,
+`col30` date DEFAULT NULL,
+`col31` longtext,
+`col32` date DEFAULT NULL,
+`col33` float DEFAULT NULL,
+`col34` bigint(20) DEFAULT NULL,
+`col35` tinytext,
+`col36` mediumtext,
+`col37` time DEFAULT NULL,
+`col38` int(11) DEFAULT NULL,
+`col39` tinyint(4) DEFAULT NULL,
+`col40` set('test1','test2','test3') DEFAULT NULL,
+`col41` char(130) DEFAULT NULL,
+`col42` smallint(6) DEFAULT NULL,
+`col43` int(11) DEFAULT NULL,
+`col44` mediumtext,
+`col45` varchar(126) DEFAULT NULL,
+`col46` int(11) DEFAULT NULL,
+`col47` double DEFAULT NULL,
+`col48` bigint(20) DEFAULT NULL,
+`col49` mediumtext,
+`col50` tinyblob,
+`col51` mediumint(9) DEFAULT NULL,
+`col52` text,
+`col53` varchar(208) DEFAULT NULL,
+`col54` varchar(207) DEFAULT NULL,
+`col55` decimal(10,0) DEFAULT NULL,
+`col56` datetime DEFAULT NULL,
+`col57` enum('test1','test2','test3') DEFAULT NULL,
+`col58` decimal(10,0) DEFAULT NULL,
+`col59` tinyblob,
+`col60` varchar(73) DEFAULT NULL,
+`col61` mediumtext,
+`col62` tinyblob,
+`col63` datetime DEFAULT NULL,
+`col64` decimal(10,0) DEFAULT NULL,
+`col65` mediumint(9) DEFAULT NULL,
+`col66` datetime DEFAULT NULL,
+`col67` decimal(10,0) DEFAULT NULL,
+`col68` tinyint(4) DEFAULT NULL,
+`col69` varchar(58) DEFAULT NULL,
+`col70` decimal(10,0) DEFAULT NULL,
+`col71` mediumtext,
+`col72` date DEFAULT NULL,
+`col73` time DEFAULT NULL,
+`col74` double DEFAULT NULL,
+`col75` decimal(10,0) DEFAULT NULL,
+`col76` mediumblob,
+`col77` double DEFAULT NULL,
+`col78` year(4) DEFAULT NULL,
+`col79` year(4) DEFAULT NULL,
+`col80` varchar(255) DEFAULT NULL,
+`col81` blob,
+`col82` bigint(20) DEFAULT NULL,
+`col83` enum('test1','test2','test3') DEFAULT NULL,
+`col84` decimal(10,0) DEFAULT NULL,
+`col85` set('test1','test2','test3') DEFAULT NULL,
+`col86` mediumtext,
+`col87` varchar(255) DEFAULT NULL,
+`col88` time DEFAULT NULL,
+`col89` enum('test1','test2','test3') DEFAULT NULL,
+`col90` decimal(10,0) DEFAULT NULL,
+`col91` float DEFAULT NULL,
+`col92` datetime DEFAULT NULL,
+`col93` tinytext,
+`col94` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+`col95` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+`col96` text,
+`col97` double DEFAULT NULL,
+`col98` varchar(198) DEFAULT NULL,
+`col99` time DEFAULT NULL,
+`col100` tinyint(4) DEFAULT NULL,
+`col101` bigint(20) DEFAULT NULL,
+`col102` varchar(255) DEFAULT NULL,
+`col103` varchar(255) DEFAULT NULL,
+`col104` mediumint(9) DEFAULT NULL,
+`col105` mediumtext,
+`col106` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+`col107` smallint(6) DEFAULT NULL,
+`col108` decimal(10,0) DEFAULT NULL,
+`col109` decimal(10,0) DEFAULT NULL,
+`col110` float DEFAULT NULL,
+`col111` decimal(10,0) DEFAULT NULL,
+`col112` double DEFAULT NULL,
+`col113` tinytext,
+`col114` float DEFAULT NULL,
+`col115` varchar(7) DEFAULT NULL,
+`col116` longtext,
+`col117` date DEFAULT NULL,
+`col118` bigint(20) DEFAULT NULL,
+`col119` text,
+`col120` bigint(20) DEFAULT NULL,
+`col121` blob,
+`col122` char(110) DEFAULT NULL,
+`col123` decimal(10,0) DEFAULT NULL,
+`col124` mediumblob,
+`col125` decimal(10,0) DEFAULT NULL,
+`col126` decimal(10,0) DEFAULT NULL,
+`col127` tinyint(1) DEFAULT NULL,
+`col128` time DEFAULT NULL,
+`col129` tinyblob,
+`col130` tinyblob,
+`col131` date DEFAULT NULL,
+`col132` int(11) DEFAULT NULL,
+`col133` varchar(123) DEFAULT NULL,
+`col134` char(238) DEFAULT NULL,
+`col135` varchar(225) DEFAULT NULL,
+`col136` longtext,
+`col137` varchar(255) DEFAULT NULL,
+`col138` double DEFAULT NULL,
+`col139` tinyblob,
+`col140` datetime DEFAULT NULL,
+`col141` tinytext,
+`col142` varchar(255) DEFAULT NULL,
+`col143` bigint(20) DEFAULT NULL,
+`col144` varchar(236) DEFAULT NULL,
+`col145` text,
+`col146` year(4) DEFAULT NULL,
+`col147` decimal(10,0) DEFAULT NULL,
+`col148` text,
+`col149` mediumblob,
+`col150` tinyint(4) DEFAULT NULL,
+`col151` tinyint(1) DEFAULT NULL,
+`col152` varchar(72) DEFAULT NULL,
+`col153` int(11) DEFAULT NULL,
+`col154` varchar(165) DEFAULT NULL,
+`col155` tinyint(4) DEFAULT NULL,
+`col156` mediumtext,
+`col157` double DEFAULT NULL,
+`col158` time DEFAULT NULL,
+`col159` mediumblob,
+`col160` varchar(255) DEFAULT NULL,
+`col161` datetime DEFAULT NULL,
+`col162` double DEFAULT NULL,
+`col163` blob,
+`col164` enum('test1','test2','test3') DEFAULT NULL,
+`col165` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+`col166` date DEFAULT NULL,
+`col167` tinyblob,
+`col168` tinyblob,
+`col169` varchar(255) DEFAULT NULL,
+`col170` datetime DEFAULT NULL,
+`col171` bigint(20) DEFAULT NULL,
+`col172` varchar(30) DEFAULT NULL,
+`col173` longtext,
+`col174` time DEFAULT NULL,
+`col175` float DEFAULT NULL,
+PRIMARY KEY (`col24`),
+KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`),
+KEY `idx1` (`col24`,`col0`(108)),
+KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`),
+KEY `idx3` (`col2`(86)),
+KEY `idx4` (`col2`(43)),
+KEY `idx5` (`col83`,`col35`(87),`col111`),
+KEY `idx6` (`col6`,`col134`,`col92`),
+KEY `idx7` (`col56`),
+KEY `idx8` (`col30`,`col53`,`col129`(66)),
+KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)),
+KEY `idx10` (`col34`),
+KEY `idx11` (`col126`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+LOCK TABLES `table5` WRITE;
+/*!40000 ALTER TABLE `table5` DISABLE KEYS */;
+INSERT INTO `table5` VALUES ('referenda','hermaphroditism','superable','00:00:00',-128,NULL,-128,'0000-00-00 00:00:00',NULL,-128,1901,NULL,'blandly',NULL,6541,'unsuspectingly',NULL,'7250','',NULL,-31358,26248,'Kilmarnock\'s',127,'-27305',28987,NULL,NULL,'-30388','utilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitarians','0000-00-00','Agincourt','0000-00-00',-28063,27242,'readies',NULL,'00:00:00',NULL,-128,'',NULL,NULL,18719,NULL,NULL,14038,17275,NULL,'gait\'s','honeymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'sho',8860,NULL,'demigod','outpulling',NULL,'1904-01-17 09:51:06','test1','-18008','grotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'s','Oakleil\'s','Shostakovich','indiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscre','2076-10-05 02:05:43','29914',-18885,'2088-05-25 13:36:33','25',-128,'Bob','-14559','ammeter','0000-00-00','00:00:00',-29756,NULL,'digressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigression',-23894,1963,1915,'SadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadye',NULL,NULL,'','17512','','anaphylaxis\'s','chiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schise','50:11:25','test1','-13685',-18328,'2020-01-19 22:04:54',NULL,'1988-05-10 10:30:56','0000-00-00 00:00:00','Birdie\'s',-27746,NULL,'179:19:25',-128,24141,'radiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparen','ingroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'sing',18950,'Beaulieu','0000-00-00 00:00:00',-23421,'-2865',NULL,NULL,NULL,NULL,'vandalizes',-24683,'interop','Apis\'s','0000-00-00',19745,'Volgograd\'s',-15194,NULL,'Binni','4540','phylumphylumphylumphylum','-25781',NULL,-128,'406:37:03','posthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthastepos','manneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristman','0000-00-00',19774,'shariah',NULL,'aquarelle','homographic',NULL,-18959,'thoroughfarethoroughfarethoroughfarethoroughfarethoroughfarethoroughfare','2000-09-05 03:33:50','Baptlsta','Witt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'s',4727,NULL,'posting',2119,'32416',NULL,'charredcharredcharredcharredcharredcharredcharredcharredcharredcharred',-128,NULL,'Rollin\'s',NULL,NULL,127,'waviness\'s',11164,'424:28:18','FaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucher','stalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'s','1901-01-29 13:48:34',-31988,'Dyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'s','','2022-01-01 21:14:30','0000-00-00','conventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalist','mirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnesses','tessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stes','2028-05-21 04:56:16',NULL,'Hasid','Hardecanute','00:00:00',-3782);
+Warnings:
+Warning 1265 Data truncated for column 'col83' at row 1
+Warning 1265 Data truncated for column 'col164' at row 1
+INSERT INTO `table5` VALUES ('hemoglobin\'s','Toffey\'s','Juvenal','00:00:00',-128,'harmonicon',-128,'2004-02-13 09:45:46',NULL,NULL,1911,'','Tananarive\'s',NULL,30666,'spiniferous',127,'30675','','Frederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFr',30388,4769,'Erymanthus\'s',127,'-20972',NULL,-17111,'explosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosiveness','-28154','magnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'s','0000-00-00','removes','0000-00-00',16859,NULL,NULL,'Moishe\'s','00:00:00',NULL,NULL,NULL,'hyperform\'s',30540,-26603,'soporific',NULL,NULL,19264,-14618,NULL,'zootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszo',5654,'intermezzi','Atkins\'s','hieroglyphically','15885','2068-10-19 12:22:30','','4972','apatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapa','severeness','pleaders',NULL,'2070-09-15 17:21:46','15245',-18313,'1934-01-01 01:20:15','-3488',127,'Delawarian','14952','foregathers','0000-00-00','00:00:00',-27837,'7143','madhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'s',-17163,1951,2054,'raffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraf','REMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMs',3607,'','-17633','',NULL,NULL,'806:59:31','test1','-29600',20301,'1985-10-09 17:57:25',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00','Perseid',-32117,'constructer\'s','612:19:03',127,NULL,'overdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingove','Carlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCa',24868,'preamble','0000-00-00 00:00:00',-7582,'-865','-14488',6884,'-24713',NULL,'topknot\'s',18469,NULL,'histrionism\'s','0000-00-00',31715,'Dag',14543,'wooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'s','tightest',NULL,'aquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'s','15603',NULL,-128,'640:34:17','acetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumaceta','torridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridl','9323-05-13',-28292,'Barnaul\'s',NULL,'slanginesses','supernova',NULL,20804,NULL,'2020-10-05 12:00:38','rive',NULL,-31498,'considerateness\'s','nevus\'s',1901,'-12956','fashioner\'s','unfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'s',-128,127,'nephralgia\'s',13881,'sciatically',NULL,'Tuesday',21227,'00:00:00','halocarbons','duvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduv','2075-01-21 10:49:44',-19735,'snubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubs','test1','0000-00-00 00:00:00','0000-00-00','kiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkib',NULL,'connoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseurscon','1953-01-23 17:36:00',NULL,'Principal',NULL,'316:28:48',NULL);
+Warnings:
+Warning 1265 Data truncated for column 'col57' at row 1
+Warning 1265 Data truncated for column 'col83' at row 1
+INSERT INTO `table5` VALUES (NULL,'Annmarie','intangibleness\'s','00:00:00',-128,'transmogrify',127,'0000-00-00 00:00:00',NULL,127,2093,'','enamored','refired',-21296,'neglectful',127,'-9992','',NULL,NULL,3583,'Lockheed\'s',127,'-15717',-29743,-16280,'embouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembou','-24875',NULL,'0000-00-00',NULL,'0000-00-00',30124,20356,'drinkable','obscenity','00:00:00',NULL,127,'',NULL,-16664,NULL,'unmoor','Vaughan\'s',30457,-16509,-10049,'squeamishness','encirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencir',-16460,'abatement\'s',NULL,'expatriate','-28670','1925-05-15 11:44:20','','-3762','DelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDel','Skerl\'s','unmatched',NULL,'1980-01-11 16:02:04','25917',18187,'2001-07-26 13:48:08','-28706',127,'gimme','8807',NULL,'0000-00-00','00:00:00',7666,'21762','drawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacks',16131,2031,2077,'subjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysub','Argenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'s',NULL,'','-17090','','fobs','humiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliat','221:02:40','','-1107',4624,'1926-05-11 03:35:52',NULL,'2037-05-13 05:02:44','0000-00-00 00:00:00','Heddie\'s',-6554,NULL,'00:00:00',127,NULL,'lxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlx','RawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawley',6613,'Beaufort','0000-00-00 00:00:00',12214,NULL,'25469',-26474,'12062',NULL,'physiographer',26382,'cosmogo','deportment\'s','0000-00-00',17492,'propretor\'s',NULL,'zingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzing','Suzetta','25513','tearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkers','21613',NULL,-128,'108:58:18','sporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallyspo','Monera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'','0000-00-00',18776,'diffractometer',NULL,'crawls','Inglebert','unguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableun',18112,'melanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanis','1940-05-18 13:21:00','artlessly','blotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblots',6476,NULL,'Bartlett',2143,NULL,'thaumaturge\'s','Hazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'s',127,127,'Winthorpe',-29765,'idiocrasy\'s',NULL,'sandcastles',-9852,'281:41:52','Volny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'s','protagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagon','2076-01-04 15:01:57',NULL,'auscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultations','','0000-00-00 00:00:00','0000-00-00','limenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimen','accommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatingly',NULL,'2018-01-01 05:48:54',17404,NULL,NULL,'195:36:50',24658);
+Warnings:
+Warning 1265 Data truncated for column 'col57' at row 1
+Warning 1265 Data truncated for column 'col83' at row 1
+Warning 1265 Data truncated for column 'col89' at row 1
+Warning 1265 Data truncated for column 'col164' at row 1
+INSERT INTO `table5` VALUES ('caddishly',NULL,'Kotah','00:00:00',-128,'tailoring',127,'0000-00-00 00:00:00','trustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustie',-128,1967,NULL,NULL,'parallelisms',NULL,NULL,127,NULL,'',NULL,NULL,-513,NULL,NULL,'-14518',NULL,-22393,'AngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAng','32257','regalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregaling','0000-00-00','newspaperwoman','0000-00-00',24845,-17741,'impassiveness','Antillean','00:00:00',-13615,-128,'','gantries',-27983,-6070,'Benetton','aridest',NULL,21574,-25634,'McWilliams\'s','burrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowe',18947,NULL,NULL,'surrealistic',NULL,'1954-07-07 08:58:49','test1','-11714','ExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExEx','administrants','Oxycontin','interpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterper','1914-05-28 05:15:03','3942',NULL,'2046-09-07 18:16:36','3220',127,'arising','18472','anacolutha','0000-00-00','613:15:45',NULL,'-23969',NULL,18979,2031,1975,'AlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcesti','septicitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticities',-25058,'',NULL,'','Kulturkampf','pollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpol','00:00:00','','12283',2881,'1926-12-10 09:24:42','Darken\'s','2034-12-21 15:59:00','0000-00-00 00:00:00',NULL,NULL,NULL,'305:05:06',127,NULL,'feudalityfeudality','Merrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMer',-25733,'borak','0000-00-00 00:00:00',-11465,'877',NULL,-1029,'5107',NULL,'Balaton\'s',NULL,'Martian','miserliness','0000-00-00',14689,'catchment',18457,'billet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'s','humerus\'s','24741',NULL,NULL,'-19233',-128,'00:00:00','fashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfas','judiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjud','0000-00-00',15972,'Letrice\'s','hydrographer',NULL,'Federica','evidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevi',4115,'pshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspsh','1924-10-15 16:31:18','Hamlet','trowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'',-3485,'galvanized',NULL,1924,'-22877','unfired','inchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'s',-128,-128,'VHF',-5304,NULL,127,'glossator',16348,'213:10:59','',NULL,'1946-01-11 17:25:16',262,'DoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDouty','test1','0000-00-00 00:00:00','0000-00-00',NULL,'feasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasibl','contortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionistic','2027-06-09 07:56:16',6909,'tessitura','indefensible','00:00:00',-6628);
+Warnings:
+Warning 1265 Data truncated for column 'col83' at row 1
+Warning 1265 Data truncated for column 'col89' at row 1
+INSERT INTO `table5` VALUES ('bassoonist\'s',NULL,'refastens','114:27:50',127,'unrestricted',127,'2032-01-13 11:11:22','abstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'s',NULL,1955,'','Hodosh','allocates',-5067,'Cenac\'s',-128,'31546',NULL,'impassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassab',-30347,292,'Sandi\'s',NULL,'-12402',8206,NULL,'encircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircl','6346','ArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentinians','0000-00-00','Riehl\'s','0000-00-00',NULL,5580,'planets',NULL,'58:35:07',317,127,'','gender',-19514,7112,'Pissaro','relevantly',28777,-21818,-17111,'shoddiness\'s',NULL,NULL,'flee','Boatwright\'s','restrict','12537','2096-04-25 08:45:21','test1','-4613','quagga','masterstroke\'s','overcheck\'s',NULL,'1981-10-14 18:30:02','21097',-26481,'2065-07-11 02:13:44',NULL,NULL,'bathroom','-29833','gracelessness\'s','0000-00-00','09:44:40',-7368,NULL,'applecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'s',-21077,2015,2039,'cascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scas','nervingnervingnervingnervingnervingnervingnervingnervingnervingnerving',22043,'','5740','','mustached','actin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'s','00:00:00','test1','13871',-22276,'1956-01-05 15:08:47','slimline','0000-00-00 00:00:00','0000-00-00 00:00:00','royally',NULL,'mako','51:54:53',NULL,NULL,'deliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'s','DOADOADOADOADOADOADOADOADOADOADOADOADOA',-16244,'Fayette\'s','2020-06-21 05:34:18',-24353,'24097','-28819',12278,'-2365',21322,'stumps',-61,NULL,'subpoena\'s','0000-00-00',31242,'knicker',23567,NULL,'Cathar','29557','thallusthallusthallusthallusthallusthallusthallusthallusthallusthallus','26114',NULL,-128,'00:00:00','salmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsal','shiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshive','0000-00-00',-3152,'syndesis','misbrands','Smiga','stagnation\'s','nonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricno',NULL,NULL,'1988-09-11 14:33:03',NULL,'provokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglypr',25510,'thunderpeal\'s','hierology',1932,'7729','Fahrenheit','metathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'s',NULL,-128,'sinfonia\'s',-6293,'proactive',127,NULL,-24751,'00:00:00','woodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopper','Constantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'','1997-01-01 22:40:48',NULL,'MatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlick','test1','2000-12-17 11:19:08','0000-00-00',NULL,'cosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmica','Loesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesc','2078-07-25 04:56:08',10472,NULL,NULL,'345:12:02',-13120);
+Warnings:
+Warning 1265 Data truncated for column 'col83' at row 1
+INSERT INTO `table5` VALUES ('segmentation\'s','shapelessness\'s','coagulators','127:46:24',-128,NULL,127,'0000-00-00 00:00:00','seekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingsee',NULL,2085,'','indent','flyblown',NULL,'Alegre',-128,'-27917','','DesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDes',2473,NULL,'screwball\'s',NULL,'-4861',-7088,-30734,'tambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintam',NULL,NULL,'0000-00-00','Dorcia','0000-00-00',-25745,-1237,'Shoifet\'s','sarsaparillas','21:11:41',31612,-128,'','subway\'s',-5032,-30369,'preventives','lyre',7995,21283,13197,'chippies','rubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubig',19050,'orch','semiliterates','Gerome',NULL,'2058-12-26 21:29:19','',NULL,'dyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdya','Dukas\'s','Christiania','polyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvale','1920-05-23 14:07:00','672',NULL,'1956-06-27 12:15:00','-22658',NULL,'holograph\'s',NULL,'gutsy','0000-00-00','00:00:00',-9558,'1148','fainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfains',NULL,2023,2132,'Balmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBal','overdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdo',-24707,'test1','-13970','','tensility','BuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddie','00:00:00','','580',25115,'2000-07-01 09:01:36','apprentice','1992-01-01 08:55:38','0000-00-00 00:00:00','premunire',24664,NULL,'821:21:05',NULL,-29284,'rapidestrapidestrapidestrapidestrapidestrapidestrapidest','convectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorcon',-3808,'intuitively','0000-00-00 00:00:00',-22296,NULL,'2802',28786,NULL,NULL,'loanword',-12107,'deodori','strophe','0000-00-00',-11013,'undeclared',-8513,'sinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'s','peloria\'s','14940','blushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblush','30550','11566',127,'00:00:00','worktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'swo','looker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'s','5657-05-11',23094,'onerousness','bearer','censured','Shoemaker','mulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomul',5930,'ZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoust','1953-04-28 11:55:44','consulted','invalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinv',-27798,'carnauba\'s','Wilson',1963,NULL,'On\'s','leisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurely',NULL,-128,NULL,17674,'Queenstown\'s',-128,'convertors',1776,'576:20:59',NULL,'allegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriall','2097-10-02 08:41:26',31057,'AfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikaners','test1','0000-00-00 00:00:00','0000-00-00','backwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbac',NULL,NULL,'1932-10-01 18:49:04',12985,NULL,'leukocytes','603:54:26',-22488);
+Warnings:
+Warning 1265 Data truncated for column 'col57' at row 1
+Warning 1265 Data truncated for column 'col89' at row 1
+INSERT INTO `table5` VALUES ('Frasquito\'s','unsatisfactory','jetted','00:00:00',NULL,'Merlin\'s',127,'0000-00-00 00:00:00',NULL,NULL,1998,'','decomposer','Commons',-14813,'oversimplification\'s',NULL,'-5368','','engirdengirdengirdengirdengirdengirdengirdengirdengird',-13627,14305,'frontally',127,'18421',-32295,NULL,NULL,'21841',NULL,'0000-00-00','cytology','2424-00-17',-30542,-17621,'octarchy\'s','outfoxed','00:00:00',27469,-128,'','Kamat\'s',-24130,-5948,'riband','Betsy',NULL,-18769,NULL,NULL,'Serafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSeraf',NULL,'disconcerting',NULL,'whirly','-20343','2020-07-01 12:09:36','','-26975','antiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticant',NULL,'ecumenically','utilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilize','1952-08-01 17:53:28','7903',-5633,'2024-03-17 13:46:59','-5474',127,'Malmö\'s',NULL,NULL,'0000-00-00','571:58:00',17287,'26711','alphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetize',-15158,2001,1997,'hobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithob','Campinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'s',-5693,'test1','3741','','Audrye\'s','monstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymo','00:00:00','test1','-21023',4693,'1998-01-06 04:41:40','Silastic\'s','0000-00-00 00:00:00','0000-00-00 00:00:00','Hedelman\'s',-30080,'normalization\'s','00:00:00',NULL,8197,NULL,NULL,NULL,'nudism\'s','2005-04-13 00:31:55',29046,'8992','11992',NULL,'-1685',-11453,'mythology\'s',26185,'Pyrenea','Pedrick\'s','0000-00-00',27436,'shots',NULL,'discordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscords','bayonet','-7217','scriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscripts',NULL,'17182',NULL,'628:49:55','nunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenuncle',NULL,'0000-00-00',-17444,'celestite\'s','Adars','Hispaniola','Mesopotamians','agglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutin',31998,'electrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistriesele','2005-09-09 23:41:06','bastinaded',NULL,-10763,'impetuosity\'s','xenogenesis\'s',1947,'-29913',NULL,'taxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomies',NULL,NULL,'internees',28697,'Kharkov\'s',NULL,'Swabia',18366,'00:00:00','delayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayer','circusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycir','2066-02-13 14:27:00',-28405,NULL,'test1','0000-00-00 00:00:00','0000-00-00','heterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotr','enchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondroma','AryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAry','2090-10-13 10:03:05',NULL,NULL,'Yucatan','285:37:51',7627);
+Warnings:
+Warning 1265 Data truncated for column 'col57' at row 1
+/*!40000 ALTER TABLE `table5` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+select * from `table5` where (col2 <= '6566-06-15' AND (col24 < 'd' or col24 > 'd')) group by `col83` order by `col83` desc ;
+col0 col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 col39 col40 col41 col42 col43 col44 col45 col46 col47 col48 col49 col50 col51 col52 col53 col54 col55 col56 col57 col58 col59 col60 col61 col62 col63 col64 col65 col66 col67 col68 col69 col70 col71 col72 col73 col74 col75 col76 col77 col78 col79 col80 col81 col82 col83 col84 col85 col86 col87 col88 col89 col90 col91 col92 col93 col94 col95 col96 col97 col98 col99 col100 col101 col102 col103 col104 col105 col106 col107 col108 col109 col110 col111 col112 col113 col114 col115 col116 col117 col118 col119 col120 col121 col122 col123 col124 col125 col126 col127 col128 col129 col130 col131 col132 col133 col134 col135 col136 col137 col138 col139 col140 col141 col142 col143 col144 col145 col146 col147 col148 col149 col150 col151 col152 col153 col154 col155 col156 col157 col158 col159 col160 col161 col162 col163 col164 col165 col166 col167 col168 col169 col170 col171 col172 col173 col174 col175
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+drop table `table5`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result
new file mode 100644
index 00000000..af0262e1
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result
@@ -0,0 +1,31 @@
+CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY
+KEY(c1), UNIQUE INDEX(c2));
+insert into t1 values('-838:59:59','-838:59:59','2009-01-21');
+insert into t1 values('00:00:00','00:00:00','2009-01-09');
+insert into t1 values('00:00:11','00:00:11','2009-01-20');
+insert into t1 values('00:00:12','00:00:12','2009-01-13');
+insert into t1 values('00:00:45','00:00:45','2009-01-07');
+insert into t1 values('00:11:12','00:11:12','2009-01-19');
+insert into t1 values('00:12:30','00:12:30','2009-01-23');
+insert into t1 values('00:12:34','00:12:34','2009-01-14');
+insert into t1 values('01:23:00','01:23:00','2009-01-03');
+insert into t1 values('08:03:02','08:03:02','2009-01-18');
+insert into t1 values('08:29:45',NULL,'2009-02-01');
+insert into t1 values('09:00:45','09:00:45','2009-01-24');
+insert into t1 values('09:36:00','09:36:00','2009-01-25');
+insert into t1 values('10:00:00','10:00:00','2009-01-06');
+insert into t1 values('10:11:12','10:11:12','2009-01-11');
+insert into t1 values('10:22:33','10:22:33','2009-01-02');
+insert into t1 values('11:11:12','11:11:12','2009-01-12');
+insert into t1 values('11:11:27','11:11:27','2009-01-17');
+insert into t1 values('12:34:56','12:34:56','2009-01-01');
+insert into t1 values('12:34:58','12:34:58','2009-01-15');
+insert into t1 values('12:35:56','12:35:56','2009-01-16');
+insert into t1 values('491:22:33','491:22:33','2009-01-04');
+insert into t1 values('825:23:00','825:23:00','2009-01-05');
+insert into t1 values('838:59:59','838:59:59','2009-01-21');
+SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC;
+c1 c2 c3
+SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC LIMIT 2;
+c1 c2 c3
+drop table t1;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result
new file mode 100644
index 00000000..f6f5cd7c
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result
@@ -0,0 +1,13 @@
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY
+KEY(c1), UNIQUE INDEX(c2)) engine=innodb;
+INSERT INTO t1 VALUES('8:29:45',NULL,'2009-02-01');
+SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
+c1 c2 c3
+08:29:45 NULL 2009-02-01
+SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
+c1 c2 c3
+08:29:45 NULL 2009-02-01
+drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result
new file mode 100644
index 00000000..7e838906
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result
@@ -0,0 +1,46 @@
+#
+# Bug#43360 - Server crash with a simple multi-table update
+#
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+CREATE TABLE t1 (
+a CHAR(2) NOT NULL PRIMARY KEY,
+b VARCHAR(20) NOT NULL,
+KEY (b)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+a CHAR(2) NOT NULL PRIMARY KEY,
+b VARCHAR(20) NOT NULL,
+KEY (b)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+('AB','MySQLAB'),
+('JA','Sun Microsystems'),
+('MS','Microsoft'),
+('IB','IBM- Inc.'),
+('GO','Google Inc.');
+INSERT IGNORE INTO t2 VALUES
+('AB','Sweden'),
+('JA','USA'),
+('MS','United States of America'),
+('IB','North America'),
+('GO','South America');
+Warnings:
+Warning 1265 Data truncated for column 'b' at row 3
+UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'United%';
+SELECT * FROM t1;
+a b
+GO Google Inc.
+IB IBM- Inc.
+MS Microsoft
+AB MySQLAB
+JA Sun Microsystems
+SELECT * FROM t2;
+a b
+IB North America
+GO South America
+AB Sweden
+MS United States of Ame
+JA USA
+DROP TABLE t1,t2;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result
new file mode 100644
index 00000000..9b7a2c45
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43448.result
@@ -0,0 +1,32 @@
+#
+# Bug#43448 - Server crashes on multi table delete with Innodb
+#
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+CREATE TABLE t1 (
+id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+t CHAR(12)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id2 INT NOT NULL,
+t CHAR(12)
+) ENGINE=InnoDB;
+CREATE TABLE t3(
+id3 INT NOT NULL,
+t CHAR(12),
+INDEX(id3)
+) ENGINE=InnoDB;
+SELECT COUNT(*) FROM t1 WHERE id1 > 90;
+COUNT(*)
+10
+SELECT COUNT(*) FROM t2 WHERE id2 > 90;
+COUNT(*)
+50
+SELECT COUNT(*) FROM t3 WHERE id3 > 90;
+COUNT(*)
+500
+DELETE t1, t2, t3
+FROM t1, t2, t3
+WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5;
+DROP TABLE t1, t2, t3;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
new file mode 100644
index 00000000..b92b42ac
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
@@ -0,0 +1,104 @@
+set default_storage_engine=innodb;
+set @save_time_zone= @@time_zone;
+set time_zone='+03:00';
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+SET TIMESTAMP=1233216687;
+INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
+INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
+DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
+INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+SELECT * FROM t1;
+c1 c2 c3 c4
+0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00
+1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00
+1983-09-07 00:00:00 1983-09-07 00:00:00 1983-09-08 1983-09-08 00:00:00
+1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00
+1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00
+1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45
+1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45
+2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28
+2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
+2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
+2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
+INSERT IGNORE INTO t1(c1,c2) VALUES('20070525','20070527') /* doesnt throw error */;
+Warnings:
+Warning 1062 Duplicate entry '2007-05-25 00:00:00' for key 'PRIMARY'
+INSERT IGNORE INTO t1(c1,c2) VALUES(19840905,830907) /* doesnt throw error */;
+Warnings:
+Warning 1062 Duplicate entry '1983-09-07 00:00:00' for key 'c2'
+SELECT * FROM t1 WHERE c1='20070527' /* Returns no rows */;
+c1 c2 c3 c4
+INSERT INTO t1(c1) VALUES('20070525') ON DUPLICATE KEY UPDATE c1='20070527';
+SELECT * FROM t1 WHERE c1='20070527' /* Returns 1 row with c1=2007-05-27 */;
+c1 c2 c3 c4
+2007-05-27 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
+SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns no rows */;
+c1 c2 c3 c4
+INSERT INTO t1(c1,c2) VALUES(19840905,830907) ON DUPLICATE KEY UPDATE c1=19830909,c2=830910;
+SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns 1 row */;
+c1 c2 c3 c4
+1983-09-09 00:00:00 1983-09-10 00:00:00 1983-09-08 1983-09-08 00:00:00
+INSERT INTO t1 SET c1='1999-01-01',c2='1999-01-01';
+SELECT * FROM t1 WHERE c1='1999-01-01' AND c2='1999-01-01' /* Returns 1 row with values for other column as NULL */;
+c1 c2 c3 c4
+1999-01-01 00:00:00 1999-01-01 00:00:00 NULL NULL
+INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06');
+DELETE FROM t1 WHERE c1=NOW() /* because the row with current timestamp exists */;
+INSERT INTO t1 VALUES(NULL,NOW(),NOW(),NOW());
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+SELECT * FROM t1 WHERE c1 IS NULL /* returns no rows */;
+c1 c2 c3 c4
+SELECT * FROM t1 WHERE c1=NOW() /* returns 1 row */;
+c1 c2 c3 c4
+2009-01-29 11:11:27 2009-01-29 11:11:27 2009-01-29 2009-01-29 11:11:27
+SELECT * FROM t1;
+c1 c2 c3 c4
+0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00
+1971-01-01 00:00:01 1980-01-01 00:00:01 2009-01-01 2009-01-02 00:00:00
+1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00
+1983-09-09 00:00:00 1983-09-10 00:00:00 1983-09-08 1983-09-08 00:00:00
+1990-01-01 00:00:01 2000-01-01 00:00:01 2009-01-03 2009-01-04 00:00:00
+1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00
+1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00
+1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45
+1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45
+1999-01-01 00:00:00 1999-01-01 00:00:00 NULL NULL
+2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28
+2007-05-27 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
+2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
+2009-01-29 11:11:27 2009-01-29 11:11:27 2009-01-29 2009-01-29 11:11:27
+2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2;
+c1 c2 c3 c4
+2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 LIMIT 2;
+c1 c2 c3 c4
+2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC;
+c1 c2 c3 c4
+2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC LIMIT 2;
+c1 c2 c3 c4
+2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
+DROP TABLE t1;
+set time_zone= @save_time_zone;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result
new file mode 100644
index 00000000..d3d04cbf
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result
@@ -0,0 +1,51 @@
+set @save_time_zone= @@time_zone;
+set time_zone='+03:00';
+CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+Note 1265 Data truncated for column 'c3' at row 2
+INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+SET TIMESTAMP=1233216687;
+INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+Warnings:
+Note 1265 Data truncated for column 'c3' at row 1
+INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
+INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
+DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
+INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+Warning 1265 Data truncated for column 'c2' at row 1
+INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06');
+SELECT * FROM t1;
+c1 c2 c3 c4
+0000-00-00 00:00:00 0000-00-00 00:00:00 2008-01-04 2008-01-05 00:00:00
+1971-01-01 00:00:01 1980-01-01 00:00:01 2009-01-01 2009-01-02 00:00:00
+1983-09-05 13:28:00 1983-09-05 13:28:00 1983-09-06 1983-09-06 13:28:00
+1983-09-07 00:00:00 1983-09-07 00:00:00 1983-09-08 1983-09-08 00:00:00
+1990-01-01 00:00:01 2000-01-01 00:00:01 2009-01-03 2009-01-04 00:00:00
+1998-12-28 00:00:00 1998-12-28 00:00:00 1998-12-28 1998-12-28 00:00:00
+1998-12-29 00:00:00 1998-12-29 00:00:00 1998-12-29 1998-12-29 00:00:00
+1998-12-30 11:30:45 1998-12-30 11:30:45 1998-12-30 1998-12-30 11:30:45
+1998-12-31 11:30:45 1998-12-31 11:30:45 1998-12-31 1998-12-31 11:30:45
+2007-05-23 09:15:28 2007-05-23 09:15:28 2007-05-24 2007-05-24 09:15:28
+2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
+2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
+2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
+2038-01-09 03:14:07 2038-01-09 03:14:07 2009-01-05 2009-01-06 00:00:00
+SELECT * FROM t1 WHERE c1 BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY c1 DESC LIMIT 2;
+c1 c2 c3 c4
+2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
+2008-01-01 00:00:00 NULL 2008-01-02 2008-01-03 00:00:00
+SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2;
+c1 c2 c3 c4
+2009-01-29 11:11:27 2009-01-29 00:00:00 2009-01-29 2009-01-29 00:00:00
+2007-05-25 00:00:00 2007-05-25 00:00:00 2007-05-26 2007-05-26 00:00:00
+DROP TABLE t1;
+set time_zone= @save_time_zone;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result
new file mode 100644
index 00000000..1335120b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45219.result
@@ -0,0 +1,158 @@
+DROP TABLE IF EXISTS CC, C, BB;
+CREATE TABLE `CC` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`datetime_key` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `CC` VALUES
+(10,0,'2006-07-07 07:26:28','q'),(11,5,'2002-09-23 00:00:00','m'),
+(12,7,'0000-00-00 00:00:00','j'),(13,1,'2006-06-07 00:00:00','z'),
+(14,8,'2000-09-16 12:15:34','a'),(15,2,'2007-08-05 15:47:52',''),
+(16,1,'0000-00-00 00:00:00','e'),(17,8,'2005-12-02 19:34:26','t'),
+(18,5,'0000-00-00 00:00:00','q'),(19,4,'0000-00-00 00:00:00','b'),
+(20,5,'2007-12-28 00:00:00','w'),(21,3,'2004-08-02 11:48:43','m'),
+(22,0,'0000-00-00 00:00:00','x'),(23,8,'2004-04-19 12:18:43',''),
+(24,0,'2009-04-27 00:00:00','w'),(25,4,'2006-10-20 14:52:15','x'),
+(26,0,'0000-00-00 00:00:00','e'),(27,0,'2002-03-22 11:48:37','e'),
+(28,2,'0000-00-00 00:00:00','p'),(29,0,'2001-01-04 03:55:07','x');
+CREATE TABLE `C` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`datetime_key` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+INSERT INTO `C` VALUES
+(1,9,'0000-00-00 00:00:00','p'),(2,0,'2002-02-09 07:38:13','v'),
+(3,8,'2001-05-03 12:08:14','t'),(4,3,'0000-00-00 00:00:00','u'),
+(5,7,'2009-07-28 03:43:30','n'),(6,0,'2009-08-04 00:00:00','l'),
+(7,1,'0000-00-00 00:00:00','h'),(8,9,'0000-00-00 00:00:00','u'),
+(9,0,'2005-08-02 17:16:54','n'),(10,9,'2002-12-21 00:00:00','j'),
+(11,0,'2005-08-15 12:37:35','k'),(12,5,'0000-00-00 00:00:00','e'),
+(13,0,'2006-03-10 00:00:00','i'),(14,8,'2005-05-16 11:02:36','u'),
+(15,8,'2008-11-02 00:00:00','n'),(16,5,'2006-03-15 00:00:00','b'),
+(17,1,'0000-00-00 00:00:00','x'),(18,7,'0000-00-00 00:00:00',''),
+(19,0,'2008-12-17 20:15:40','q'),(20,9,'0000-00-00 00:00:00','u');
+CREATE TABLE `BB` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`datetime_key` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES
+(10,8,'2007-08-19 08:08:38','i'),(11,0,'2000-05-21 03:51:51','');
+SELECT DISTINCT `datetime_key`
+FROM C
+WHERE ( `int_nokey` , `pk` ) IN (
+SELECT INNR .`pk` , INNR .`pk`
+FROM CC LEFT JOIN BB INNR ON INNR .`varchar_key` ) AND `pk` = 9 ;
+datetime_key
+DROP TABLE CC, C, BB;
+DROP TABLE IF EXISTS CC, C, BB;
+CREATE TABLE `CC` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`int_key` int(11) NOT NULL,
+`date_key` date NOT NULL,
+`datetime_key` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+`varchar_nokey` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `date_key` (`date_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `CC` VALUES
+(10,0,8,'2007-02-14','2006-07-07 07:26:28','q','q'),
+(11,5,8,'2002-10-03','2002-09-23 00:00:00','m','m'),
+(12,7,3,'2006-12-02','0000-00-00 00:00:00','j','j'),
+(13,1,2,'2007-05-02','2006-06-07 00:00:00','z','z'),
+(14,8,2,'2001-11-18','2000-09-16 12:15:34','a','a'),
+(15,2,6,'2006-09-09','2007-08-05 15:47:52','',''),
+(16,1,8,'0000-00-00','0000-00-00 00:00:00','e','e'),
+(17,8,9,'2003-07-22','2005-12-02 19:34:26','t','t'),
+(18,5,2,'2001-12-22','0000-00-00 00:00:00','q','q'),
+(19,4,6,'0000-00-00','0000-00-00 00:00:00','b','b'),
+(20,5,5,'2006-09-02','2007-12-28 00:00:00','w','w'),
+(21,3,2,'0000-00-00','2004-08-02 11:48:43','m','m'),
+(22,0,4,'0000-00-00','0000-00-00 00:00:00','x','x'),
+(23,8,9,'2001-02-28','2004-04-19 12:18:43','',''),
+(24,0,6,'0000-00-00','2009-04-27 00:00:00','w','w'),
+(25,4,5,'2007-05-19','2006-10-20 14:52:15','x','x'),
+(26,0,0,'2005-02-15','0000-00-00 00:00:00','e','e'),
+(27,0,0,'2000-10-19','2002-03-22 11:48:37','e','e'),
+(28,2,8,'2005-07-07','0000-00-00 00:00:00','p','p'),
+(29,0,0,'2008-10-18','2001-01-04 03:55:07','x','x');
+CREATE TABLE `C` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`int_key` int(11) NOT NULL,
+`date_key` date NOT NULL,
+`datetime_key` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+`varchar_nokey` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `date_key` (`date_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+INSERT INTO `C` VALUES
+(1,9,9,'2007-12-01','0000-00-00 00:00:00','p','p'),
+(2,0,0,'0000-00-00','2002-02-09 07:38:13','v','v'),
+(3,8,6,'0000-00-00','2001-05-03 12:08:14','t','t'),
+(4,3,6,'2002-05-07','0000-00-00 00:00:00','u','u'),
+(5,7,6,'0000-00-00','2009-07-28 03:43:30','n','n'),
+(6,0,4,'0000-00-00','2009-08-04 00:00:00','l','l'),
+(7,1,7,'0000-00-00','0000-00-00 00:00:00','h','h'),
+(8,9,4,'0000-00-00','0000-00-00 00:00:00','u','u'),
+(9,0,8,'0000-00-00','2005-08-02 17:16:54','n','n'),
+(10,9,4,'2000-12-18','2002-12-21 00:00:00','j','j'),
+(11,0,7,'2005-11-13','2005-08-15 12:37:35','k','k'),
+(12,5,5,'0000-00-00','0000-00-00 00:00:00','e','e'),
+(13,0,0,'2003-11-12','2006-03-10 00:00:00','i','i'),
+(14,8,5,'2006-02-20','2005-05-16 11:02:36','u','u'),
+(15,8,7,'2005-02-12','2008-11-02 00:00:00','n','n'),
+(16,5,2,'2009-07-20','2006-03-15 00:00:00','b','b'),
+(17,1,8,'2005-02-24','0000-00-00 00:00:00','x','x'),
+(18,7,0,'0000-00-00','0000-00-00 00:00:00','',''),
+(19,0,9,'0000-00-00','2008-12-17 20:15:40','q','q'),
+(20,9,5,'0000-00-00','0000-00-00 00:00:00','u','u');
+CREATE TABLE `BB` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`int_key` int(11) NOT NULL,
+`date_key` date NOT NULL,
+`datetime_key` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+`varchar_nokey` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `date_key` (`date_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES (10,8,5,'0000-00-00','2007-08-19
+08:08:38','i','i'),(11,0,8,'2005-08-18','2000-05-21 03:51:51','','');
+SELECT DISTINCT BIT_AND( OUTR . `datetime_key` ) AS X
+FROM C AS OUTR
+WHERE ( OUTR . `int_nokey` , OUTR . `pk` ) IN (
+SELECT DISTINCT INNR . `pk` AS X , INNR . `pk` AS Y
+FROM CC AS INNR2 LEFT JOIN BB AS INNR ON
+( INNR2 . `varchar_nokey` = INNR . `varchar_key` )
+WHERE INNR . `date_key` BETWEEN '2009-04-26' AND '2004-08-21' )
+AND OUTR . `pk` = 9
+ORDER BY OUTR . `int_key` , OUTR . `pk`;
+X
+18446744073709551615
+DROP TABLE CC, C, BB;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result
new file mode 100644
index 00000000..79100ca2
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result
@@ -0,0 +1,108 @@
+CREATE TABLE `t2` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_key` int(11) DEFAULT NULL,
+`date_nokey` date DEFAULT NULL,
+`datetime_nokey` datetime DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+Warnings:
+Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release
+INSERT INTO `t2` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00');
+CREATE TABLE t1 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_key` int(11) DEFAULT NULL,
+`date_nokey` date DEFAULT NULL,
+`datetime_nokey` datetime DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+Warnings:
+Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release
+INSERT INTO t1 VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00');
+SELECT `pk`
+FROM t1 OUTR
+WHERE `pk` IN (
+SELECT `int_key`
+FROM t2
+WHERE `date_nokey` < `datetime_nokey` XOR OUTR .`date_nokey` ) ;
+pk
+9
+2
+5
+6
+SELECT `pk`
+FROM t1
+WHERE `pk` IN (
+SELECT `int_key`
+FROM t2
+WHERE `date_nokey` < `datetime_nokey` XOR '2009-11-25' ) ;
+pk
+2
+4
+5
+6
+9
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE `t2` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) DEFAULT NULL,
+`int_key` int(11) DEFAULT NULL,
+`date_nokey` date DEFAULT NULL,
+`datetime_key` datetime DEFAULT NULL,
+`datetime_nokey` datetime DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+Warnings:
+Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release
+INSERT INTO `t2` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00');
+CREATE TABLE t1 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) DEFAULT NULL,
+`int_key` int(11) DEFAULT NULL,
+`date_nokey` date DEFAULT NULL,
+`datetime_key` datetime DEFAULT NULL,
+`datetime_nokey` datetime DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+Warnings:
+Note 1831 Duplicate index `varchar_key`. This is deprecated and will be disallowed in a future release
+INSERT INTO t1 VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00');
+SELECT OUTR . `pk` AS X
+FROM t1 AS OUTR
+WHERE OUTR . `pk` IN (
+SELECT INNR . `int_key` AS Y
+FROM t2 AS INNR
+WHERE INNR . `date_nokey` < INNR . `datetime_nokey` XOR OUTR . `date_nokey` BETWEEN '2004-07-10' AND '2009-11-25'
+ORDER BY INNR . `int_nokey` ) AND ( OUTR . `datetime_key` BETWEEN '2000-05-25' AND '2004-08-07' OR OUTR . `datetime_nokey` = '2007-10-24' )
+ORDER BY OUTR . `int_key` , OUTR . `pk`;
+X
+9
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result
new file mode 100644
index 00000000..5e34d285
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result
@@ -0,0 +1,39 @@
+SET SESSION optimizer_switch = 'firstmatch=off,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on';
+CREATE TABLE t0 (a INT);
+INSERT INTO t0 VALUES (0),(1),(2),(3),(4);
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 SELECT a, a from t0;
+CREATE TABLE t2 (a INT, b INT, PRIMARY KEY(a));
+INSERT INTO t2 SELECT * FROM t1;
+UPDATE t1 SET a=3, b=11 WHERE a=4;
+UPDATE t2 SET b=11 WHERE a=3;
+
+# This result is wrong, but will be fixed by Bug#46556
+SELECT * FROM t0 WHERE t0.a IN
+(SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
+a
+0
+1
+2
+3
+SET join_cache_level = 6;
+
+# This result is even more wrong ;-)
+SELECT * FROM t0 WHERE t0.a IN
+(SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
+a
+0
+1
+2
+3
+SET SESSION optimizer_switch = 'semijoin=off';
+
+# This result is correct
+SELECT * FROM t0 WHERE t0.a IN
+(SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
+a
+0
+1
+2
+3
+DROP TABLE t0, t1, t2;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test
new file mode 100644
index 00000000..5c316c0a
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test
@@ -0,0 +1,16 @@
+# test for BUG#36981 "innodb crash when selecting for update"
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+# crash requires this
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+create table `t1` (`c1` char(1) default null,`c2` char(10) default null,
+key (`c1`))
+engine=innodb default charset=latin1;
+insert into `t1` values ('3',null);
+select * from `t1` where `c1`='3' for update;
+drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test
new file mode 100644
index 00000000..41d38445
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test
@@ -0,0 +1,23 @@
+--echo #
+--echo # Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on
+--echo #
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+SET @saved_dbug = @@SESSION.debug_dbug;
+# Crash requires that we enable Index Condition Pushdown in InnoDB
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+CREATE TABLE t (
+ dummy INT PRIMARY KEY,
+ a INT UNIQUE,
+ b int
+) ENGINE=InnoDB;
+
+INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5);
+
+SELECT * FROM t WHERE a > 2 FOR UPDATE;
+
+DROP TABLE t;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt
new file mode 100644
index 00000000..bb3f82d4
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt
@@ -0,0 +1 @@
+--loose-innodb_lock_wait_timeout=3
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test
new file mode 100644
index 00000000..b7c0dc53
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test
@@ -0,0 +1,44 @@
+# test for BUG#41029:
+# "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+select @default_binlog_format:=@@global.binlog_format;
+set global binlog_format=row;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+
+# bug requires this
+set session debug_dbug="+d,optimizer_innodb_ds_mrr";
+
+set autocommit=0;
+use test;
+drop table if exists t1;
+create table t1 (dummy int primary key, a int unique, b int) engine=innodb;
+insert into t1 values(1,1,1),(3,3,3),(5,5,5);
+commit;
+set session transaction isolation level repeatable read;
+select @@tx_isolation;
+start transaction;
+select * from t1 where a > 2 for update;
+
+connection con2;
+
+use test;
+set autocommit=0;
+start transaction;
+select 1;
+--error ER_LOCK_WAIT_TIMEOUT
+insert into t1 values(2,2,2);
+rollback;
+
+connection con1;
+rollback;
+
+drop table t1;
+connection default;
+set global binlog_format=@default_binlog_format;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test
new file mode 100644
index 00000000..09fcccb0
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1-innodb.test
@@ -0,0 +1,489 @@
+set @bug41996_extra1_tmp=@@optimizer_switch;
+set optimizer_switch='mrr=off';
+--disable_warnings
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+--enable_warnings
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+set optimizer_switch=@bug41996_extra1_tmp;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test
new file mode 100644
index 00000000..5170ec22
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra1.test
@@ -0,0 +1,488 @@
+set @bug41996_tmp=@@optimizer_switch;
+set optimizer_switch='mrr=off';
+--disable_warnings
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+--enable_warnings
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE d1.t1, d2.t2 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE d1.t1.*, d2.t2.*, d3.t3 FROM d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+set optimizer_switch=@bug41996_tmp;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test
new file mode 100644
index 00000000..2590ed7b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2-innodb.test
@@ -0,0 +1,486 @@
+--disable_warnings
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+--enable_warnings
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test
new file mode 100644
index 00000000..2590ed7b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra2.test
@@ -0,0 +1,486 @@
+--disable_warnings
+DROP DATABASE IF EXISTS d1;
+DROP DATABASE IF EXISTS d2;
+DROP DATABASE IF EXISTS d3;
+--enable_warnings
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+CREATE DATABASE d1;
+CREATE DATABASE d2;
+CREATE DATABASE d3;
+CREATE TABLE d1.t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d2.t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE d3.t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO d1.t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO d2.t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO d3.t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM d1.t1, d2.t2 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM d1.t1, d2.t2, d3.t3 USING d1.t1, d2.t2, d3.t3 WHERE d1.t1.c1=d2.t2.c2 AND d2.t2.c1=d3.t3.c2;
+SELECT * FROM d1.t1 ORDER BY c1;
+SELECT * FROM d2.t2 ORDER BY c1;
+SELECT * FROM d3.t3 ORDER BY c1;
+DROP DATABASE d1;
+DROP DATABASE d2;
+DROP DATABASE d3;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test
new file mode 100644
index 00000000..70e727a4
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3-innodb.test
@@ -0,0 +1,363 @@
+--disable_warnings
+--enable_warnings
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test
new file mode 100644
index 00000000..70e727a4
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra3.test
@@ -0,0 +1,363 @@
+--disable_warnings
+--enable_warnings
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE t1, t2 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE t1.*, t2.*, t3 FROM t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test
new file mode 100644
index 00000000..ce0be3c7
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4-innodb.test
@@ -0,0 +1,363 @@
+--disable_warnings
+--enable_warnings
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test
new file mode 100644
index 00000000..ce0be3c7
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996-extra4.test
@@ -0,0 +1,363 @@
+--disable_warnings
+--enable_warnings
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 TINYINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 SMALLINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 MEDIUMINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t2 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+CREATE TABLE t3 (c1 BIGINT NOT NULL PRIMARY KEY, c2 INTEGER, KEY(c2));
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(4,4),(5,5);
+INSERT INTO t2 VALUES(11,1),(12,1),(13,1),(14,2),(15,6);
+INSERT INTO t3 VALUES(21,11),(22,11),(23,13),(24,14),(25,15);
+DELETE QUICK IGNORE FROM t1, t2 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DELETE QUICK IGNORE FROM t1, t2, t3 USING t1, t2, t3 WHERE t1.c1=t2.c2 AND t2.c1=t3.c2;
+SELECT * FROM t1 ORDER BY c1;
+SELECT * FROM t2 ORDER BY c1;
+SELECT * FROM t3 ORDER BY c1;
+DROP TABLE t1,t2,t3;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test
new file mode 100644
index 00000000..0eb7e34a
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test
@@ -0,0 +1,16 @@
+# Test for BUG#41996 "multi-table delete crashes server (InnoDB
+# table)"
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+# crash requires this
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+drop table if exists `t1`;
+create table `t1` (`c` bigint, key(`c`),`a` int)engine=innodb;
+insert into `t1` values(2,2);
+delete `t1` from `t1` `a`, `t1` where `a`.`a`=`t1`.`c` ;
+drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
new file mode 100644
index 00000000..9e8e5c4b
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
@@ -0,0 +1,250 @@
+--source include/have_debug.inc
+# Test for BUG#42991 "invalid memory access and/or crash when using
+# index condition pushdown + InnoDB"
+# Note that you need to run with --valgrind to see the warnings
+# about invalid memory accesses.
+
+--source include/have_innodb.inc
+
+SET @saved_dbug = @@SESSION.debug_dbug;
+# Valgrind errors happen only with this:
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+DROP TABLE IF EXISTS `table5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `table5` (
+ `col0` mediumtext,
+ `col1` varchar(90) DEFAULT NULL,
+ `col2` tinytext,
+ `col3` time DEFAULT NULL,
+ `col4` tinyint(1) DEFAULT NULL,
+ `col5` tinytext,
+ `col6` tinyint(1) DEFAULT NULL,
+ `col7` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `col8` tinyblob,
+ `col9` tinyint(4) DEFAULT NULL,
+ `col10` year(4) DEFAULT NULL,
+ `col11` set('test1','test2','test3') DEFAULT NULL,
+ `col12` text,
+ `col13` char(248) DEFAULT NULL,
+ `col14` bigint(20) DEFAULT NULL,
+ `col15` text,
+ `col16` tinyint(4) DEFAULT NULL,
+ `col17` decimal(10,0) DEFAULT NULL,
+ `col18` set('test1','test2','test3') DEFAULT NULL,
+ `col19` varchar(255) DEFAULT NULL,
+ `col20` float DEFAULT NULL,
+ `col21` int(11) DEFAULT NULL,
+ `col22` text,
+ `col23` tinyint(1) DEFAULT NULL,
+ `col24` decimal(10,0) NOT NULL DEFAULT '0',
+ `col25` double DEFAULT NULL,
+ `col26` float DEFAULT NULL,
+ `col27` tinyblob,
+ `col28` decimal(10,0) DEFAULT NULL,
+ `col29` mediumblob,
+ `col30` date DEFAULT NULL,
+ `col31` longtext,
+ `col32` date DEFAULT NULL,
+ `col33` float DEFAULT NULL,
+ `col34` bigint(20) DEFAULT NULL,
+ `col35` tinytext,
+ `col36` mediumtext,
+ `col37` time DEFAULT NULL,
+ `col38` int(11) DEFAULT NULL,
+ `col39` tinyint(4) DEFAULT NULL,
+ `col40` set('test1','test2','test3') DEFAULT NULL,
+ `col41` char(130) DEFAULT NULL,
+ `col42` smallint(6) DEFAULT NULL,
+ `col43` int(11) DEFAULT NULL,
+ `col44` mediumtext,
+ `col45` varchar(126) DEFAULT NULL,
+ `col46` int(11) DEFAULT NULL,
+ `col47` double DEFAULT NULL,
+ `col48` bigint(20) DEFAULT NULL,
+ `col49` mediumtext,
+ `col50` tinyblob,
+ `col51` mediumint(9) DEFAULT NULL,
+ `col52` text,
+ `col53` varchar(208) DEFAULT NULL,
+ `col54` varchar(207) DEFAULT NULL,
+ `col55` decimal(10,0) DEFAULT NULL,
+ `col56` datetime DEFAULT NULL,
+ `col57` enum('test1','test2','test3') DEFAULT NULL,
+ `col58` decimal(10,0) DEFAULT NULL,
+ `col59` tinyblob,
+ `col60` varchar(73) DEFAULT NULL,
+ `col61` mediumtext,
+ `col62` tinyblob,
+ `col63` datetime DEFAULT NULL,
+ `col64` decimal(10,0) DEFAULT NULL,
+ `col65` mediumint(9) DEFAULT NULL,
+ `col66` datetime DEFAULT NULL,
+ `col67` decimal(10,0) DEFAULT NULL,
+ `col68` tinyint(4) DEFAULT NULL,
+ `col69` varchar(58) DEFAULT NULL,
+ `col70` decimal(10,0) DEFAULT NULL,
+ `col71` mediumtext,
+ `col72` date DEFAULT NULL,
+ `col73` time DEFAULT NULL,
+ `col74` double DEFAULT NULL,
+ `col75` decimal(10,0) DEFAULT NULL,
+ `col76` mediumblob,
+ `col77` double DEFAULT NULL,
+ `col78` year(4) DEFAULT NULL,
+ `col79` year(4) DEFAULT NULL,
+ `col80` varchar(255) DEFAULT NULL,
+ `col81` blob,
+ `col82` bigint(20) DEFAULT NULL,
+ `col83` enum('test1','test2','test3') DEFAULT NULL,
+ `col84` decimal(10,0) DEFAULT NULL,
+ `col85` set('test1','test2','test3') DEFAULT NULL,
+ `col86` mediumtext,
+ `col87` varchar(255) DEFAULT NULL,
+ `col88` time DEFAULT NULL,
+ `col89` enum('test1','test2','test3') DEFAULT NULL,
+ `col90` decimal(10,0) DEFAULT NULL,
+ `col91` float DEFAULT NULL,
+ `col92` datetime DEFAULT NULL,
+ `col93` tinytext,
+ `col94` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col95` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col96` text,
+ `col97` double DEFAULT NULL,
+ `col98` varchar(198) DEFAULT NULL,
+ `col99` time DEFAULT NULL,
+ `col100` tinyint(4) DEFAULT NULL,
+ `col101` bigint(20) DEFAULT NULL,
+ `col102` varchar(255) DEFAULT NULL,
+ `col103` varchar(255) DEFAULT NULL,
+ `col104` mediumint(9) DEFAULT NULL,
+ `col105` mediumtext,
+ `col106` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col107` smallint(6) DEFAULT NULL,
+ `col108` decimal(10,0) DEFAULT NULL,
+ `col109` decimal(10,0) DEFAULT NULL,
+ `col110` float DEFAULT NULL,
+ `col111` decimal(10,0) DEFAULT NULL,
+ `col112` double DEFAULT NULL,
+ `col113` tinytext,
+ `col114` float DEFAULT NULL,
+ `col115` varchar(7) DEFAULT NULL,
+ `col116` longtext,
+ `col117` date DEFAULT NULL,
+ `col118` bigint(20) DEFAULT NULL,
+ `col119` text,
+ `col120` bigint(20) DEFAULT NULL,
+ `col121` blob,
+ `col122` char(110) DEFAULT NULL,
+ `col123` decimal(10,0) DEFAULT NULL,
+ `col124` mediumblob,
+ `col125` decimal(10,0) DEFAULT NULL,
+ `col126` decimal(10,0) DEFAULT NULL,
+ `col127` tinyint(1) DEFAULT NULL,
+ `col128` time DEFAULT NULL,
+ `col129` tinyblob,
+ `col130` tinyblob,
+ `col131` date DEFAULT NULL,
+ `col132` int(11) DEFAULT NULL,
+ `col133` varchar(123) DEFAULT NULL,
+ `col134` char(238) DEFAULT NULL,
+ `col135` varchar(225) DEFAULT NULL,
+ `col136` longtext,
+ `col137` varchar(255) DEFAULT NULL,
+ `col138` double DEFAULT NULL,
+ `col139` tinyblob,
+ `col140` datetime DEFAULT NULL,
+ `col141` tinytext,
+ `col142` varchar(255) DEFAULT NULL,
+ `col143` bigint(20) DEFAULT NULL,
+ `col144` varchar(236) DEFAULT NULL,
+ `col145` text,
+ `col146` year(4) DEFAULT NULL,
+ `col147` decimal(10,0) DEFAULT NULL,
+ `col148` text,
+ `col149` mediumblob,
+ `col150` tinyint(4) DEFAULT NULL,
+ `col151` tinyint(1) DEFAULT NULL,
+ `col152` varchar(72) DEFAULT NULL,
+ `col153` int(11) DEFAULT NULL,
+ `col154` varchar(165) DEFAULT NULL,
+ `col155` tinyint(4) DEFAULT NULL,
+ `col156` mediumtext,
+ `col157` double DEFAULT NULL,
+ `col158` time DEFAULT NULL,
+ `col159` mediumblob,
+ `col160` varchar(255) DEFAULT NULL,
+ `col161` datetime DEFAULT NULL,
+ `col162` double DEFAULT NULL,
+ `col163` blob,
+ `col164` enum('test1','test2','test3') DEFAULT NULL,
+ `col165` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col166` date DEFAULT NULL,
+ `col167` tinyblob,
+ `col168` tinyblob,
+ `col169` varchar(255) DEFAULT NULL,
+ `col170` datetime DEFAULT NULL,
+ `col171` bigint(20) DEFAULT NULL,
+ `col172` varchar(30) DEFAULT NULL,
+ `col173` longtext,
+ `col174` time DEFAULT NULL,
+ `col175` float DEFAULT NULL,
+ PRIMARY KEY (`col24`),
+ KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`),
+ KEY `idx1` (`col24`,`col0`(108)),
+ KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`),
+ KEY `idx3` (`col2`(86)),
+ KEY `idx4` (`col2`(43)),
+ KEY `idx5` (`col83`,`col35`(87),`col111`),
+ KEY `idx6` (`col6`,`col134`,`col92`),
+ KEY `idx7` (`col56`),
+ KEY `idx8` (`col30`,`col53`,`col129`(66)),
+ KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)),
+ KEY `idx10` (`col34`),
+ KEY `idx11` (`col126`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+
+LOCK TABLES `table5` WRITE;
+/*!40000 ALTER TABLE `table5` DISABLE KEYS */;
+INSERT INTO `table5` VALUES ('referenda','hermaphroditism','superable','00:00:00',-128,NULL,-128,'0000-00-00 00:00:00',NULL,-128,1901,NULL,'blandly',NULL,6541,'unsuspectingly',NULL,'7250','',NULL,-31358,26248,'Kilmarnock\'s',127,'-27305',28987,NULL,NULL,'-30388','utilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitariansutilitarians','0000-00-00','Agincourt','0000-00-00',-28063,27242,'readies',NULL,'00:00:00',NULL,-128,'',NULL,NULL,18719,NULL,NULL,14038,17275,NULL,'gait\'s','honeymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'shoneymoon\'sho',8860,NULL,'demigod','outpulling',NULL,'1904-01-17 09:51:06','test1','-18008','grotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'sgrotesqueness\'s','Oakleil\'s','Shostakovich','indiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscretionsindiscre','2076-10-05 02:05:43','29914',-18885,'2088-05-25 13:36:33','25',-128,'Bob','-14559','ammeter','0000-00-00','00:00:00',-29756,NULL,'digressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigressiondigression',-23894,1963,1915,'SadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadyeSadye',NULL,NULL,'','17512','','anaphylaxis\'s','chiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schiseler\'schise','50:11:25','test1','-13685',-18328,'2020-01-19 22:04:54',NULL,'1988-05-10 10:30:56','0000-00-00 00:00:00','Birdie\'s',-27746,NULL,'179:19:25',-128,24141,'radiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparentradiotransparen','ingroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'singroup\'sing',18950,'Beaulieu','0000-00-00 00:00:00',-23421,'-2865',NULL,NULL,NULL,NULL,'vandalizes',-24683,'interop','Apis\'s','0000-00-00',19745,'Volgograd\'s',-15194,NULL,'Binni','4540','phylumphylumphylumphylum','-25781',NULL,-128,'406:37:03','posthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthasteposthastepos','manneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristmanneristman','0000-00-00',19774,'shariah',NULL,'aquarelle','homographic',NULL,-18959,'thoroughfarethoroughfarethoroughfarethoroughfarethoroughfarethoroughfare','2000-09-05 03:33:50','Baptlsta','Witt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'sWitt\'s',4727,NULL,'posting',2119,'32416',NULL,'charredcharredcharredcharredcharredcharredcharredcharredcharredcharred',-128,NULL,'Rollin\'s',NULL,NULL,127,'waviness\'s',11164,'424:28:18','FaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucherFaucher','stalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'sstalactite\'s','1901-01-29 13:48:34',-31988,'Dyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'sDyan\'s','','2022-01-01 21:14:30','0000-00-00','conventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalistconventionalist','mirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnessesmirthlessnesses','tessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stessellation\'stes','2028-05-21 04:56:16',NULL,'Hasid','Hardecanute','00:00:00',-3782);
+INSERT INTO `table5` VALUES ('hemoglobin\'s','Toffey\'s','Juvenal','00:00:00',-128,'harmonicon',-128,'2004-02-13 09:45:46',NULL,NULL,1911,'','Tananarive\'s',NULL,30666,'spiniferous',127,'30675','','Frederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFrederick\'sFr',30388,4769,'Erymanthus\'s',127,'-20972',NULL,-17111,'explosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosivenessexplosiveness','-28154','magnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'smagnitude\'s','0000-00-00','removes','0000-00-00',16859,NULL,NULL,'Moishe\'s','00:00:00',NULL,NULL,NULL,'hyperform\'s',30540,-26603,'soporific',NULL,NULL,19264,-14618,NULL,'zootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszootechnicszo',5654,'intermezzi','Atkins\'s','hieroglyphically','15885','2068-10-19 12:22:30','','4972','apatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapatosaurapa','severeness','pleaders',NULL,'2070-09-15 17:21:46','15245',-18313,'1934-01-01 01:20:15','-3488',127,'Delawarian','14952','foregathers','0000-00-00','00:00:00',-27837,'7143','madhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'smadhouse\'s',-17163,1951,2054,'raffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraffiaraf','REMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMsREMs',3607,'','-17633','',NULL,NULL,'806:59:31','test1','-29600',20301,'1985-10-09 17:57:25',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00','Perseid',-32117,'constructer\'s','612:19:03',127,NULL,'overdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingoverdressingove','Carlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCarlstrom\'sCa',24868,'preamble','0000-00-00 00:00:00',-7582,'-865','-14488',6884,'-24713',NULL,'topknot\'s',18469,NULL,'histrionism\'s','0000-00-00',31715,'Dag',14543,'wooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'swooziness\'s','tightest',NULL,'aquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'saquiculture\'s','15603',NULL,-128,'640:34:17','acetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumacetabulumaceta','torridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridlytorridl','9323-05-13',-28292,'Barnaul\'s',NULL,'slanginesses','supernova',NULL,20804,NULL,'2020-10-05 12:00:38','rive',NULL,-31498,'considerateness\'s','nevus\'s',1901,'-12956','fashioner\'s','unfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'sunfitness\'s',-128,127,'nephralgia\'s',13881,'sciatically',NULL,'Tuesday',21227,'00:00:00','halocarbons','duvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduvetynduv','2075-01-21 10:49:44',-19735,'snubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubssnubs','test1','0000-00-00 00:00:00','0000-00-00','kiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkiblahkib',NULL,'connoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseursconnoisseurscon','1953-01-23 17:36:00',NULL,'Principal',NULL,'316:28:48',NULL);
+INSERT INTO `table5` VALUES (NULL,'Annmarie','intangibleness\'s','00:00:00',-128,'transmogrify',127,'0000-00-00 00:00:00',NULL,127,2093,'','enamored','refired',-21296,'neglectful',127,'-9992','',NULL,NULL,3583,'Lockheed\'s',127,'-15717',-29743,-16280,'embouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembouchureembou','-24875',NULL,'0000-00-00',NULL,'0000-00-00',30124,20356,'drinkable','obscenity','00:00:00',NULL,127,'',NULL,-16664,NULL,'unmoor','Vaughan\'s',30457,-16509,-10049,'squeamishness','encirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencirclingencir',-16460,'abatement\'s',NULL,'expatriate','-28670','1925-05-15 11:44:20','','-3762','DelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDelwynDel','Skerl\'s','unmatched',NULL,'1980-01-11 16:02:04','25917',18187,'2001-07-26 13:48:08','-28706',127,'gimme','8807',NULL,'0000-00-00','00:00:00',7666,'21762','drawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacksdrawbacks',16131,2031,2077,'subjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysubjectivitysub','Argenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'sArgenteuil\'s',NULL,'','-17090','','fobs','humiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliatinglyhumiliat','221:02:40','','-1107',4624,'1926-05-11 03:35:52',NULL,'2037-05-13 05:02:44','0000-00-00 00:00:00','Heddie\'s',-6554,NULL,'00:00:00',127,NULL,'lxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlxlx','RawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawleyRawley',6613,'Beaufort','0000-00-00 00:00:00',12214,NULL,'25469',-26474,'12062',NULL,'physiographer',26382,'cosmogo','deportment\'s','0000-00-00',17492,'propretor\'s',NULL,'zingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzingzing','Suzetta','25513','tearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkerstearjerkers','21613',NULL,-128,'108:58:18','sporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallysporadicallyspo','Monera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'sMonera\'','0000-00-00',18776,'diffractometer',NULL,'crawls','Inglebert','unguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableunguessableun',18112,'melanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanismmelanis','1940-05-18 13:21:00','artlessly','blotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblotsblots',6476,NULL,'Bartlett',2143,NULL,'thaumaturge\'s','Hazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'sHazelton\'s',127,127,'Winthorpe',-29765,'idiocrasy\'s',NULL,'sandcastles',-9852,'281:41:52','Volny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'sVolny\'s','protagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagonist\'sprotagon','2076-01-04 15:01:57',NULL,'auscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultationsauscultations','','0000-00-00 00:00:00','0000-00-00','limenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimenlimen','accommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatinglyaccommodatingly',NULL,'2018-01-01 05:48:54',17404,NULL,NULL,'195:36:50',24658);
+INSERT INTO `table5` VALUES ('caddishly',NULL,'Kotah','00:00:00',-128,'tailoring',127,'0000-00-00 00:00:00','trustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustiestrustie',-128,1967,NULL,NULL,'parallelisms',NULL,NULL,127,NULL,'',NULL,NULL,-513,NULL,NULL,'-14518',NULL,-22393,'AngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAngeliAng','32257','regalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregalingregaling','0000-00-00','newspaperwoman','0000-00-00',24845,-17741,'impassiveness','Antillean','00:00:00',-13615,-128,'','gantries',-27983,-6070,'Benetton','aridest',NULL,21574,-25634,'McWilliams\'s','burrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowedburrowe',18947,NULL,NULL,'surrealistic',NULL,'1954-07-07 08:58:49','test1','-11714','ExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExExEx','administrants','Oxycontin','interpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterpersonalinterper','1914-05-28 05:15:03','3942',NULL,'2046-09-07 18:16:36','3220',127,'arising','18472','anacolutha','0000-00-00','613:15:45',NULL,'-23969',NULL,18979,2031,1975,'AlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcestisAlcesti','septicitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticitiessepticities',-25058,'',NULL,'','Kulturkampf','pollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpollutantpol','00:00:00','','12283',2881,'1926-12-10 09:24:42','Darken\'s','2034-12-21 15:59:00','0000-00-00 00:00:00',NULL,NULL,NULL,'305:05:06',127,NULL,'feudalityfeudality','Merrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMerrili\'sMer',-25733,'borak','0000-00-00 00:00:00',-11465,'877',NULL,-1029,'5107',NULL,'Balaton\'s',NULL,'Martian','miserliness','0000-00-00',14689,'catchment',18457,'billet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'sbillet\'s','humerus\'s','24741',NULL,NULL,'-19233',-128,'00:00:00','fashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfashfas','judiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjudiciaryjud','0000-00-00',15972,'Letrice\'s','hydrographer',NULL,'Federica','evidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevidentlyevi',4115,'pshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspshawspsh','1924-10-15 16:31:18','Hamlet','trowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'strowel\'',-3485,'galvanized',NULL,1924,'-22877','unfired','inchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'sinchworm\'s',-128,-128,'VHF',-5304,NULL,127,'glossator',16348,'213:10:59','',NULL,'1946-01-11 17:25:16',262,'DoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDoutyDouty','test1','0000-00-00 00:00:00','0000-00-00',NULL,'feasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasiblefeasibl','contortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionisticcontortionistic','2027-06-09 07:56:16',6909,'tessitura','indefensible','00:00:00',-6628);
+INSERT INTO `table5` VALUES ('bassoonist\'s',NULL,'refastens','114:27:50',127,'unrestricted',127,'2032-01-13 11:11:22','abstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'sabstainer\'s',NULL,1955,'','Hodosh','allocates',-5067,'Cenac\'s',-128,'31546',NULL,'impassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassabilityimpassab',-30347,292,'Sandi\'s',NULL,'-12402',8206,NULL,'encircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircleencircl','6346','ArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentiniansArgentinians','0000-00-00','Riehl\'s','0000-00-00',NULL,5580,'planets',NULL,'58:35:07',317,127,'','gender',-19514,7112,'Pissaro','relevantly',28777,-21818,-17111,'shoddiness\'s',NULL,NULL,'flee','Boatwright\'s','restrict','12537','2096-04-25 08:45:21','test1','-4613','quagga','masterstroke\'s','overcheck\'s',NULL,'1981-10-14 18:30:02','21097',-26481,'2065-07-11 02:13:44',NULL,NULL,'bathroom','-29833','gracelessness\'s','0000-00-00','09:44:40',-7368,NULL,'applecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'sapplecart\'s',-21077,2015,2039,'cascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scascara\'scas','nervingnervingnervingnervingnervingnervingnervingnervingnervingnerving',22043,'','5740','','mustached','actin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'sactin\'s','00:00:00','test1','13871',-22276,'1956-01-05 15:08:47','slimline','0000-00-00 00:00:00','0000-00-00 00:00:00','royally',NULL,'mako','51:54:53',NULL,NULL,'deliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'sdeliquescence\'s','DOADOADOADOADOADOADOADOADOADOADOADOADOA',-16244,'Fayette\'s','2020-06-21 05:34:18',-24353,'24097','-28819',12278,'-2365',21322,'stumps',-61,NULL,'subpoena\'s','0000-00-00',31242,'knicker',23567,NULL,'Cathar','29557','thallusthallusthallusthallusthallusthallusthallusthallusthallusthallus','26114',NULL,-128,'00:00:00','salmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsalmonoidsal','shiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshiveshive','0000-00-00',-3152,'syndesis','misbrands','Smiga','stagnation\'s','nonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricnonelectricno',NULL,NULL,'1988-09-11 14:33:03',NULL,'provokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglyprovokinglypr',25510,'thunderpeal\'s','hierology',1932,'7729','Fahrenheit','metathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'smetathesis\'s',NULL,-128,'sinfonia\'s',-6293,'proactive',127,NULL,-24751,'00:00:00','woodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopperwoodchopper','Constantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'sConstantinople\'','1997-01-01 22:40:48',NULL,'MatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlickMatlick','test1','2000-12-17 11:19:08','0000-00-00',NULL,'cosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmicalcosmica','Loesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesceke\'sLoesc','2078-07-25 04:56:08',10472,NULL,NULL,'345:12:02',-13120);
+INSERT INTO `table5` VALUES ('segmentation\'s','shapelessness\'s','coagulators','127:46:24',-128,NULL,127,'0000-00-00 00:00:00','seekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingseekingsee',NULL,2085,'','indent','flyblown',NULL,'Alegre',-128,'-27917','','DesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDesiraeDes',2473,NULL,'screwball\'s',NULL,'-4861',-7088,-30734,'tambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintambourintam',NULL,NULL,'0000-00-00','Dorcia','0000-00-00',-25745,-1237,'Shoifet\'s','sarsaparillas','21:11:41',31612,-128,'','subway\'s',-5032,-30369,'preventives','lyre',7995,21283,13197,'chippies','rubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubiginousrubig',19050,'orch','semiliterates','Gerome',NULL,'2058-12-26 21:29:19','',NULL,'dyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdyad\'sdya','Dukas\'s','Christiania','polyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvalenciespolyvale','1920-05-23 14:07:00','672',NULL,'1956-06-27 12:15:00','-22658',NULL,'holograph\'s',NULL,'gutsy','0000-00-00','00:00:00',-9558,'1148','fainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfainsfains',NULL,2023,2132,'Balmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBalmung\'sBal','overdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdooverdo',-24707,'test1','-13970','','tensility','BuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddieBuddie','00:00:00','','580',25115,'2000-07-01 09:01:36','apprentice','1992-01-01 08:55:38','0000-00-00 00:00:00','premunire',24664,NULL,'821:21:05',NULL,-29284,'rapidestrapidestrapidestrapidestrapidestrapidestrapidest','convectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorconvectorcon',-3808,'intuitively','0000-00-00 00:00:00',-22296,NULL,'2802',28786,NULL,NULL,'loanword',-12107,'deodori','strophe','0000-00-00',-11013,'undeclared',-8513,'sinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'ssinuosity\'s','peloria\'s','14940','blushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblushblush','30550','11566',127,'00:00:00','worktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'sworktable\'swo','looker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'slooker\'s','5657-05-11',23094,'onerousness','bearer','censured','Shoemaker','mulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomulattomul',5930,'ZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoustZlatoust','1953-04-28 11:55:44','consulted','invalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinvalidity\'sinv',-27798,'carnauba\'s','Wilson',1963,NULL,'On\'s','leisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurelyleisurely',NULL,-128,NULL,17674,'Queenstown\'s',-128,'convertors',1776,'576:20:59',NULL,'allegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriallegriall','2097-10-02 08:41:26',31057,'AfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikanersAfrikaners','test1','0000-00-00 00:00:00','0000-00-00','backwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbackwardsbac',NULL,NULL,'1932-10-01 18:49:04',12985,NULL,'leukocytes','603:54:26',-22488);
+INSERT INTO `table5` VALUES ('Frasquito\'s','unsatisfactory','jetted','00:00:00',NULL,'Merlin\'s',127,'0000-00-00 00:00:00',NULL,NULL,1998,'','decomposer','Commons',-14813,'oversimplification\'s',NULL,'-5368','','engirdengirdengirdengirdengirdengirdengirdengirdengird',-13627,14305,'frontally',127,'18421',-32295,NULL,NULL,'21841',NULL,'0000-00-00','cytology','2424-00-17',-30542,-17621,'octarchy\'s','outfoxed','00:00:00',27469,-128,'','Kamat\'s',-24130,-5948,'riband','Betsy',NULL,-18769,NULL,NULL,'Serafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSerafina\'sSeraf',NULL,'disconcerting',NULL,'whirly','-20343','2020-07-01 12:09:36','','-26975','antiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticantiphlogisticant',NULL,'ecumenically','utilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilizerutilize','1952-08-01 17:53:28','7903',-5633,'2024-03-17 13:46:59','-5474',127,'Malmö\'s',NULL,NULL,'0000-00-00','571:58:00',17287,'26711','alphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetizealphabetize',-15158,2001,1997,'hobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithobbithob','Campinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'sCampinas\'s',-5693,'test1','3741','','Audrye\'s','monstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymonstrouslymo','00:00:00','test1','-21023',4693,'1998-01-06 04:41:40','Silastic\'s','0000-00-00 00:00:00','0000-00-00 00:00:00','Hedelman\'s',-30080,'normalization\'s','00:00:00',NULL,8197,NULL,NULL,NULL,'nudism\'s','2005-04-13 00:31:55',29046,'8992','11992',NULL,'-1685',-11453,'mythology\'s',26185,'Pyrenea','Pedrick\'s','0000-00-00',27436,'shots',NULL,'discordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscordsdiscords','bayonet','-7217','scriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscripts',NULL,'17182',NULL,'628:49:55','nunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenunclenuncle',NULL,'0000-00-00',-17444,'celestite\'s','Adars','Hispaniola','Mesopotamians','agglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutinativeagglutin',31998,'electrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistrieselectrochemistriesele','2005-09-09 23:41:06','bastinaded',NULL,-10763,'impetuosity\'s','xenogenesis\'s',1947,'-29913',NULL,'taxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomiestaxonomies',NULL,NULL,'internees',28697,'Kharkov\'s',NULL,'Swabia',18366,'00:00:00','delayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayerdelayer','circusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycircusycir','2066-02-13 14:27:00',-28405,NULL,'test1','0000-00-00 00:00:00','0000-00-00','heterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotrophicheterotr','enchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondromaenchondroma','AryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAryAry','2090-10-13 10:03:05',NULL,NULL,'Yucatan','285:37:51',7627);
+/*!40000 ALTER TABLE `table5` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+#explain select * from `table5` where (col2 <= '6566-06-15' AND (col24 < 'd' or col24 > 'd') group by `col83` order by `col83` desc ;
+
+select * from `table5` where (col2 <= '6566-06-15' AND (col24 < 'd' or col24 > 'd')) group by `col83` order by `col83` desc ;
+
+drop table `table5`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test
new file mode 100644
index 00000000..186512d5
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test
@@ -0,0 +1,41 @@
+# Test for BUG#43101 "MyISAM&Maria gives rows for <>NULL and >NULL
+# with LIMIT clause"
+
+--source include/have_debug.inc
+
+# Goes away with
+#set session debug_dbug=+d,optimizer_no_icp;
+
+CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY
+KEY(c1), UNIQUE INDEX(c2));
+
+insert into t1 values('-838:59:59','-838:59:59','2009-01-21');
+insert into t1 values('00:00:00','00:00:00','2009-01-09');
+insert into t1 values('00:00:11','00:00:11','2009-01-20');
+insert into t1 values('00:00:12','00:00:12','2009-01-13');
+insert into t1 values('00:00:45','00:00:45','2009-01-07');
+insert into t1 values('00:11:12','00:11:12','2009-01-19');
+insert into t1 values('00:12:30','00:12:30','2009-01-23');
+insert into t1 values('00:12:34','00:12:34','2009-01-14');
+insert into t1 values('01:23:00','01:23:00','2009-01-03');
+insert into t1 values('08:03:02','08:03:02','2009-01-18');
+insert into t1 values('08:29:45',NULL,'2009-02-01');
+insert into t1 values('09:00:45','09:00:45','2009-01-24');
+insert into t1 values('09:36:00','09:36:00','2009-01-25');
+insert into t1 values('10:00:00','10:00:00','2009-01-06');
+insert into t1 values('10:11:12','10:11:12','2009-01-11');
+insert into t1 values('10:22:33','10:22:33','2009-01-02');
+insert into t1 values('11:11:12','11:11:12','2009-01-12');
+insert into t1 values('11:11:27','11:11:27','2009-01-17');
+insert into t1 values('12:34:56','12:34:56','2009-01-01');
+insert into t1 values('12:34:58','12:34:58','2009-01-15');
+insert into t1 values('12:35:56','12:35:56','2009-01-16');
+insert into t1 values('491:22:33','491:22:33','2009-01-04');
+insert into t1 values('825:23:00','825:23:00','2009-01-05');
+insert into t1 values('838:59:59','838:59:59','2009-01-21');
+
+SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC;
+
+SELECT * FROM t1 WHERE c2 <> NULL ORDER BY c2 DESC LIMIT 2;
+
+drop table t1;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test
new file mode 100644
index 00000000..c647b777
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test
@@ -0,0 +1,19 @@
+# Test for BUG#43249 "Innodb returns zero time for the time column
+# with <=> NULL order by limit"
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY
+KEY(c1), UNIQUE INDEX(c2)) engine=innodb;
+INSERT INTO t1 VALUES('8:29:45',NULL,'2009-02-01');
+# first time, good results:
+SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
+# second time, bad results:
+SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
+
+drop table `t1`;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test
new file mode 100644
index 00000000..0896caa7
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test
@@ -0,0 +1,46 @@
+
+--echo #
+--echo # Bug#43360 - Server crash with a simple multi-table update
+--echo #
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+SET @saved_dbug = @@SESSION.debug_dbug;
+# crash requires this
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+CREATE TABLE t1 (
+ a CHAR(2) NOT NULL PRIMARY KEY,
+ b VARCHAR(20) NOT NULL,
+ KEY (b)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ a CHAR(2) NOT NULL PRIMARY KEY,
+ b VARCHAR(20) NOT NULL,
+ KEY (b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+('AB','MySQLAB'),
+('JA','Sun Microsystems'),
+('MS','Microsoft'),
+('IB','IBM- Inc.'),
+('GO','Google Inc.');
+
+INSERT IGNORE INTO t2 VALUES
+('AB','Sweden'),
+('JA','USA'),
+('MS','United States of America'),
+('IB','North America'),
+('GO','South America');
+
+UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'United%';
+
+SELECT * FROM t1;
+
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test
new file mode 100644
index 00000000..69181c36
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test
@@ -0,0 +1,63 @@
+--echo #
+--echo # Bug#43448 - Server crashes on multi table delete with Innodb
+--echo #
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+--source include/no_valgrind_without_big.inc
+
+SET @saved_dbug = @@SESSION.debug_dbug;
+# crash requires ICP support in InnoDB
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+CREATE TABLE t1 (
+ id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ t CHAR(12)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ id2 INT NOT NULL,
+ t CHAR(12)
+) ENGINE=InnoDB;
+
+CREATE TABLE t3(
+ id3 INT NOT NULL,
+ t CHAR(12),
+ INDEX(id3)
+) ENGINE=InnoDB;
+
+disable_query_log;
+
+begin;
+let $1 = 100;
+while ($1)
+{
+ let $2 = 5;
+ eval INSERT INTO t1(t) VALUES ('$1');
+ while ($2)
+ {
+ eval INSERT INTO t2(id2,t) VALUES ($1,'$2');
+ let $3 = 10;
+ while ($3)
+ {
+ eval INSERT INTO t3(id3,t) VALUES ($1,'$2');
+ dec $3;
+ }
+ dec $2;
+ }
+ dec $1;
+}
+commit;
+
+enable_query_log;
+
+SELECT COUNT(*) FROM t1 WHERE id1 > 90;
+SELECT COUNT(*) FROM t2 WHERE id2 > 90;
+SELECT COUNT(*) FROM t3 WHERE id3 > 90;
+
+DELETE t1, t2, t3
+FROM t1, t2, t3
+WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 5;
+
+DROP TABLE t1, t2, t3;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test
new file mode 100644
index 00000000..f0ce06da
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test
@@ -0,0 +1,87 @@
+# test for BUG#43617 "Innodb returns wrong results with timestamp's
+# range value in IN clause"
+--source include/have_debug.inc
+--source include/have_innodb.inc
+
+set default_storage_engine=innodb;
+set @save_time_zone= @@time_zone;
+set time_zone='+03:00';
+SET @saved_dbug = @@SESSION.debug_dbug;
+set session debug_dbug="+d,optimizer_innodb_icp";
+
+######## Running INSERT tests for TIMESTAMP ########
+
+# Create tables
+CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+
+# Insert some rows with targeted values
+
+# As a string in either 'YYYY-MM-DD HH:MM:SS', 'YY-MM-DD HH:MM:SS', 'YYYY-MM-DD' or 'YY-MM-DD' format
+INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+
+# As a string with no delimiters in either 'YYYYMMDDHHMMSS', 'YYMMDDHHMMSS', 'YYYYMMDD' or 'YYMMDD' format
+INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+
+# As a number in either YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format
+INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+
+# As the result of a function
+SET TIMESTAMP=1233216687; # 2009-01-29 13:41:27
+INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+
+# Insert permissible NULLs
+INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
+
+# Insert duplicate NULLs to unique column
+INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
+DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
+
+# Insert empty string '', would be converted to zero value of the appropriate type
+INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
+
+--sorted_result
+SELECT * FROM t1;
+
+# Test 'INSERT IGNORE' with the same rows that reported constraint violation above
+# Ignore pk constraint
+INSERT IGNORE INTO t1(c1,c2) VALUES('20070525','20070527') /* doesnt throw error */;
+
+# Ignore unique constraint
+INSERT IGNORE INTO t1(c1,c2) VALUES(19840905,830907) /* doesnt throw error */;
+
+# Test 'INSERT ON DUPLICATE KEY UPDATE' with single column PK
+SELECT * FROM t1 WHERE c1='20070527' /* Returns no rows */;
+INSERT INTO t1(c1) VALUES('20070525') ON DUPLICATE KEY UPDATE c1='20070527';
+SELECT * FROM t1 WHERE c1='20070527' /* Returns 1 row with c1=2007-05-27 */;
+
+# Test 'INSERT ON DUPLICATE KEY UPDATE' with single column unique
+SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns no rows */;
+INSERT INTO t1(c1,c2) VALUES(19840905,830907) ON DUPLICATE KEY UPDATE c1=19830909,c2=830910;
+SELECT * FROM t1 WHERE c1=19830909 AND c2=830910 /* Returns 1 row */;
+
+# Test 'INSERT SET'
+INSERT INTO t1 SET c1='1999-01-01',c2='1999-01-01';
+SELECT * FROM t1 WHERE c1='1999-01-01' AND c2='1999-01-01' /* Returns 1 row with values for other column as NULL */;
+
+# Test insert range values to 'TIMESTAMP' columns
+INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06');
+
+# Test insert NULL to non-null column
+# Inserting NULL to TIMESTAMP NOT NULL field doesn't throw error, but records the current/set timestamp
+
+DELETE FROM t1 WHERE c1=NOW() /* because the row with current timestamp exists */;
+INSERT INTO t1 VALUES(NULL,NOW(),NOW(),NOW());
+SELECT * FROM t1 WHERE c1 IS NULL /* returns no rows */;
+SELECT * FROM t1 WHERE c1=NOW() /* returns 1 row */;
+
+--sorted_result
+SELECT * FROM t1;
+
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2;
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 LIMIT 2;
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC;
+SELECT * FROM t1 WHERE c2 IN ('1971-01-01 00:00:01','2038-01-09 03:14:07') ORDER BY c2 DESC LIMIT 2;
+DROP TABLE t1;
+
+set time_zone= @save_time_zone;
+SET debug_dbug= @saved_dbug;
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test
new file mode 100644
index 00000000..3d9430ba
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test
@@ -0,0 +1,49 @@
+# test for BUG#43618 "MyISAM&Maria returns wrong results with
+# 'between' on timestamp"
+
+--source include/have_debug.inc
+
+set @save_time_zone= @@time_zone;
+set time_zone='+03:00';
+# bug goes away with
+#set session debug_dbug="+d,optimizer_no_icp";
+
+######## Running INSERT tests for TIMESTAMP ########
+
+# Create tables
+CREATE TABLE t1(c1 TIMESTAMP NOT NULL, c2 TIMESTAMP NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+
+# Insert some rows with targeted values
+
+# As a string in either 'YYYY-MM-DD HH:MM:SS', 'YY-MM-DD HH:MM:SS', 'YYYY-MM-DD' or 'YY-MM-DD' format
+INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+
+# As a string with no delimiters in either 'YYYYMMDDHHMMSS', 'YYMMDDHHMMSS', 'YYYYMMDD' or 'YYMMDD' format
+INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+
+# As a number in either YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format
+INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+
+# As the result of a function
+SET TIMESTAMP=1233216687; # 2009-01-29 13:41:27
+INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+
+# Insert permissible NULLs
+INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
+
+# Insert duplicate NULLs to unique column
+INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
+DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
+
+# Insert empty string '', would be converted to zero value of the appropriate type
+INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
+
+INSERT INTO t1 VALUES('1971-01-01 00:00:01','1980-01-01 00:00:01','2009-01-01','2009-01-02'),('1990-01-01 00:00:01','2000-01-01 00:00:01','2009-01-03','2009-01-04'),('2038-01-09 03:14:07','2038-01-09 03:14:07','2009-01-05','2009-01-06');
+
+--sorted_result
+SELECT * FROM t1;
+SELECT * FROM t1 WHERE c1 BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY c1 DESC LIMIT 2;
+SELECT * FROM t1 WHERE c2 BETWEEN '1971-01-01 00:00:01' AND '2010-10-00 00:00:00' ORDER BY c2 DESC LIMIT 2;
+DROP TABLE t1;
+set time_zone= @save_time_zone;
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test
new file mode 100644
index 00000000..85e24824
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45219.test
@@ -0,0 +1,183 @@
+# BUG#45219 "Azalea crash on query containing a JOIN in subquery"
+
+# Both SELECT DISTINCT cause similar crashes.
+# With ./mtr --mysqld=--optimizer_switch="semijoin=off" optimizer_unfixed_bugs.bug45219
+# there is no crash, the result file has been created with this
+# command, but it has *not* been checked for correctness of returned
+# data (at least 5.1 gives the same result).
+
+
+# Begin test case for query 0
+
+--disable_warnings
+DROP TABLE IF EXISTS CC, C, BB;
+--enable_warnings
+
+CREATE TABLE `CC` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) NOT NULL,
+ `datetime_key` datetime NOT NULL,
+ `varchar_key` varchar(1) NOT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `CC` VALUES
+(10,0,'2006-07-07 07:26:28','q'),(11,5,'2002-09-23 00:00:00','m'),
+(12,7,'0000-00-00 00:00:00','j'),(13,1,'2006-06-07 00:00:00','z'),
+(14,8,'2000-09-16 12:15:34','a'),(15,2,'2007-08-05 15:47:52',''),
+(16,1,'0000-00-00 00:00:00','e'),(17,8,'2005-12-02 19:34:26','t'),
+(18,5,'0000-00-00 00:00:00','q'),(19,4,'0000-00-00 00:00:00','b'),
+(20,5,'2007-12-28 00:00:00','w'),(21,3,'2004-08-02 11:48:43','m'),
+(22,0,'0000-00-00 00:00:00','x'),(23,8,'2004-04-19 12:18:43',''),
+(24,0,'2009-04-27 00:00:00','w'),(25,4,'2006-10-20 14:52:15','x'),
+(26,0,'0000-00-00 00:00:00','e'),(27,0,'2002-03-22 11:48:37','e'),
+(28,2,'0000-00-00 00:00:00','p'),(29,0,'2001-01-04 03:55:07','x');
+CREATE TABLE `C` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) NOT NULL,
+ `datetime_key` datetime NOT NULL,
+ `varchar_key` varchar(1) NOT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+INSERT INTO `C` VALUES
+(1,9,'0000-00-00 00:00:00','p'),(2,0,'2002-02-09 07:38:13','v'),
+(3,8,'2001-05-03 12:08:14','t'),(4,3,'0000-00-00 00:00:00','u'),
+(5,7,'2009-07-28 03:43:30','n'),(6,0,'2009-08-04 00:00:00','l'),
+(7,1,'0000-00-00 00:00:00','h'),(8,9,'0000-00-00 00:00:00','u'),
+(9,0,'2005-08-02 17:16:54','n'),(10,9,'2002-12-21 00:00:00','j'),
+(11,0,'2005-08-15 12:37:35','k'),(12,5,'0000-00-00 00:00:00','e'),
+(13,0,'2006-03-10 00:00:00','i'),(14,8,'2005-05-16 11:02:36','u'),
+(15,8,'2008-11-02 00:00:00','n'),(16,5,'2006-03-15 00:00:00','b'),
+(17,1,'0000-00-00 00:00:00','x'),(18,7,'0000-00-00 00:00:00',''),
+(19,0,'2008-12-17 20:15:40','q'),(20,9,'0000-00-00 00:00:00','u');
+CREATE TABLE `BB` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) NOT NULL,
+ `datetime_key` datetime NOT NULL,
+ `varchar_key` varchar(1) NOT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES
+(10,8,'2007-08-19 08:08:38','i'),(11,0,'2000-05-21 03:51:51','');
+
+SELECT DISTINCT `datetime_key`
+FROM C
+WHERE ( `int_nokey` , `pk` ) IN (
+SELECT INNR .`pk` , INNR .`pk`
+FROM CC LEFT JOIN BB INNR ON INNR .`varchar_key` ) AND `pk` = 9 ;
+
+DROP TABLE CC, C, BB;
+
+# End of test case for query 0
+
+# Begin test case for query 1
+
+--disable_warnings
+DROP TABLE IF EXISTS CC, C, BB;
+--enable_warnings
+
+CREATE TABLE `CC` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) NOT NULL,
+ `int_key` int(11) NOT NULL,
+ `date_key` date NOT NULL,
+ `datetime_key` datetime NOT NULL,
+ `varchar_key` varchar(1) NOT NULL,
+ `varchar_nokey` varchar(1) NOT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `date_key` (`date_key`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `CC` VALUES
+(10,0,8,'2007-02-14','2006-07-07 07:26:28','q','q'),
+(11,5,8,'2002-10-03','2002-09-23 00:00:00','m','m'),
+(12,7,3,'2006-12-02','0000-00-00 00:00:00','j','j'),
+(13,1,2,'2007-05-02','2006-06-07 00:00:00','z','z'),
+(14,8,2,'2001-11-18','2000-09-16 12:15:34','a','a'),
+(15,2,6,'2006-09-09','2007-08-05 15:47:52','',''),
+(16,1,8,'0000-00-00','0000-00-00 00:00:00','e','e'),
+(17,8,9,'2003-07-22','2005-12-02 19:34:26','t','t'),
+(18,5,2,'2001-12-22','0000-00-00 00:00:00','q','q'),
+(19,4,6,'0000-00-00','0000-00-00 00:00:00','b','b'),
+(20,5,5,'2006-09-02','2007-12-28 00:00:00','w','w'),
+(21,3,2,'0000-00-00','2004-08-02 11:48:43','m','m'),
+(22,0,4,'0000-00-00','0000-00-00 00:00:00','x','x'),
+(23,8,9,'2001-02-28','2004-04-19 12:18:43','',''),
+(24,0,6,'0000-00-00','2009-04-27 00:00:00','w','w'),
+(25,4,5,'2007-05-19','2006-10-20 14:52:15','x','x'),
+(26,0,0,'2005-02-15','0000-00-00 00:00:00','e','e'),
+(27,0,0,'2000-10-19','2002-03-22 11:48:37','e','e'),
+(28,2,8,'2005-07-07','0000-00-00 00:00:00','p','p'),
+(29,0,0,'2008-10-18','2001-01-04 03:55:07','x','x');
+CREATE TABLE `C` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) NOT NULL,
+ `int_key` int(11) NOT NULL,
+ `date_key` date NOT NULL,
+ `datetime_key` datetime NOT NULL,
+ `varchar_key` varchar(1) NOT NULL,
+ `varchar_nokey` varchar(1) NOT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `date_key` (`date_key`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+INSERT INTO `C` VALUES
+(1,9,9,'2007-12-01','0000-00-00 00:00:00','p','p'),
+(2,0,0,'0000-00-00','2002-02-09 07:38:13','v','v'),
+(3,8,6,'0000-00-00','2001-05-03 12:08:14','t','t'),
+(4,3,6,'2002-05-07','0000-00-00 00:00:00','u','u'),
+(5,7,6,'0000-00-00','2009-07-28 03:43:30','n','n'),
+(6,0,4,'0000-00-00','2009-08-04 00:00:00','l','l'),
+(7,1,7,'0000-00-00','0000-00-00 00:00:00','h','h'),
+(8,9,4,'0000-00-00','0000-00-00 00:00:00','u','u'),
+(9,0,8,'0000-00-00','2005-08-02 17:16:54','n','n'),
+(10,9,4,'2000-12-18','2002-12-21 00:00:00','j','j'),
+(11,0,7,'2005-11-13','2005-08-15 12:37:35','k','k'),
+(12,5,5,'0000-00-00','0000-00-00 00:00:00','e','e'),
+(13,0,0,'2003-11-12','2006-03-10 00:00:00','i','i'),
+(14,8,5,'2006-02-20','2005-05-16 11:02:36','u','u'),
+(15,8,7,'2005-02-12','2008-11-02 00:00:00','n','n'),
+(16,5,2,'2009-07-20','2006-03-15 00:00:00','b','b'),
+(17,1,8,'2005-02-24','0000-00-00 00:00:00','x','x'),
+(18,7,0,'0000-00-00','0000-00-00 00:00:00','',''),
+(19,0,9,'0000-00-00','2008-12-17 20:15:40','q','q'),
+(20,9,5,'0000-00-00','0000-00-00 00:00:00','u','u');
+CREATE TABLE `BB` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) NOT NULL,
+ `int_key` int(11) NOT NULL,
+ `date_key` date NOT NULL,
+ `datetime_key` datetime NOT NULL,
+ `varchar_key` varchar(1) NOT NULL,
+ `varchar_nokey` varchar(1) NOT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `date_key` (`date_key`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`varchar_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES (10,8,5,'0000-00-00','2007-08-19
+08:08:38','i','i'),(11,0,8,'2005-08-18','2000-05-21 03:51:51','','');
+
+SELECT DISTINCT BIT_AND( OUTR . `datetime_key` ) AS X
+FROM C AS OUTR
+WHERE ( OUTR . `int_nokey` , OUTR . `pk` ) IN (
+SELECT DISTINCT INNR . `pk` AS X , INNR . `pk` AS Y
+FROM CC AS INNR2 LEFT JOIN BB AS INNR ON
+( INNR2 . `varchar_nokey` = INNR . `varchar_key` )
+WHERE INNR . `date_key` BETWEEN '2009-04-26' AND '2004-08-21' )
+AND OUTR . `pk` = 9
+ORDER BY OUTR . `int_key` , OUTR . `pk`;
+
+DROP TABLE CC, C, BB;
+
+# End of test case for query 1
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test
new file mode 100644
index 00000000..f8c6b910
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test
@@ -0,0 +1,97 @@
+# test for BUG#45221 "Query "SELECT pk FROM t1 WHERE pk IN (SELECT
+# int_key)" failing"
+
+--source include/have_debug.inc
+
+# bug goes away with
+#set session debug_dbug="+d,optimizer_no_icp";
+
+# those don't remove the problem but make the result diff different:
+#set optimizer_switch="materialization=off";
+#set optimizer_switch="semijoin=off";
+#set optimizer_switch="materialization=off,semijoin=off";
+
+#/* Begin test case for query 0 */
+
+CREATE TABLE `t2` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_key` int(11) DEFAULT NULL,
+ `date_nokey` date DEFAULT NULL,
+ `datetime_nokey` datetime DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `t2` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00');
+CREATE TABLE t1 (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_key` int(11) DEFAULT NULL,
+ `date_nokey` date DEFAULT NULL,
+ `datetime_nokey` datetime DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00');
+
+SELECT `pk`
+FROM t1 OUTR
+WHERE `pk` IN (
+SELECT `int_key`
+FROM t2
+WHERE `date_nokey` < `datetime_nokey` XOR OUTR .`date_nokey` ) ;
+
+SELECT `pk`
+FROM t1
+WHERE `pk` IN (
+SELECT `int_key`
+FROM t2
+WHERE `date_nokey` < `datetime_nokey` XOR '2009-11-25' ) ;
+
+DROP TABLE t2;
+DROP TABLE t1;
+#/* End of test case for query 0 */
+
+#/* Begin test case for query 1 */
+
+CREATE TABLE `t2` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) DEFAULT NULL,
+ `int_key` int(11) DEFAULT NULL,
+ `date_nokey` date DEFAULT NULL,
+ `datetime_key` datetime DEFAULT NULL,
+ `datetime_nokey` datetime DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `t2` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00');
+CREATE TABLE t1 (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `int_nokey` int(11) DEFAULT NULL,
+ `int_key` int(11) DEFAULT NULL,
+ `date_nokey` date DEFAULT NULL,
+ `datetime_key` datetime DEFAULT NULL,
+ `datetime_nokey` datetime DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `int_key` (`int_key`),
+ KEY `datetime_key` (`datetime_key`),
+ KEY `varchar_key` (`int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00');
+
+SELECT OUTR . `pk` AS X
+FROM t1 AS OUTR
+WHERE OUTR . `pk` IN (
+SELECT INNR . `int_key` AS Y
+FROM t2 AS INNR
+WHERE INNR . `date_nokey` < INNR . `datetime_nokey` XOR OUTR . `date_nokey` BETWEEN '2004-07-10' AND '2009-11-25'
+ORDER BY INNR . `int_nokey` ) AND ( OUTR . `datetime_key` BETWEEN '2000-05-25' AND '2004-08-07' OR OUTR . `datetime_nokey` = '2007-10-24' )
+ORDER BY OUTR . `int_key` , OUTR . `pk`;
+
+
+DROP TABLE t2;
+DROP TABLE t1;
+#/* End of test case for query 1 */
+
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test b/mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test
new file mode 100644
index 00000000..e0e7179a
--- /dev/null
+++ b/mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test
@@ -0,0 +1,34 @@
+SET SESSION optimizer_switch = 'firstmatch=off,index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,loosescan=on,materialization=on,semijoin=on';
+
+CREATE TABLE t0 (a INT);
+INSERT INTO t0 VALUES (0),(1),(2),(3),(4);
+
+CREATE TABLE t1 (a INT, b INT, KEY(a));
+INSERT INTO t1 SELECT a, a from t0;
+
+CREATE TABLE t2 (a INT, b INT, PRIMARY KEY(a));
+INSERT INTO t2 SELECT * FROM t1;
+
+UPDATE t1 SET a=3, b=11 WHERE a=4;
+UPDATE t2 SET b=11 WHERE a=3;
+
+--echo
+--echo # This result is wrong, but will be fixed by Bug#46556
+SELECT * FROM t0 WHERE t0.a IN
+ (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
+
+SET join_cache_level = 6;
+
+--echo
+--echo # This result is even more wrong ;-)
+SELECT * FROM t0 WHERE t0.a IN
+ (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
+
+SET SESSION optimizer_switch = 'semijoin=off';
+
+--echo
+--echo # This result is correct
+SELECT * FROM t0 WHERE t0.a IN
+ (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
+
+DROP TABLE t0, t1, t2;