From bbf8ebe87d7c3d3d07f56457168e8faa943f7d64 Mon Sep 17 00:00:00 2001
From: unknown <monty@mashka.mysql.fi>
Date: Tue, 1 Jul 2003 13:29:55 +0300
Subject: [PATCH] Code/testcase cleanups

mysql-test/r/insert_select.result:
  Fixed results
mysql-test/r/join_outer.result:
  New test case for inner join table dependency
mysql-test/t/insert_select.test:
  Remove not used drop tables.
  Fixed table names
mysql-test/t/join_outer.test:
  New test case for inner join table dependency
sql/slave.cc:
  Simple optimizations
---
 mysql-test/r/insert_select.result | 19 ++++++++-----------
 mysql-test/r/join_outer.result    |  8 ++++++++
 mysql-test/t/insert_select.test   | 23 ++++++++++-------------
 mysql-test/t/join_outer.test      | 12 ++++++++++++
 sql/slave.cc                      |  3 +--
 5 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index b49ca3a6c2..c403ff8532 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -21,8 +21,7 @@ payoutID
 20
 22
 drop table t1,t2;
-DROP TABLE IF EXISTS crash1,crash2;
-CREATE TABLE `crash1` (
+CREATE TABLE `t1` (
 `numeropost` bigint(20) unsigned NOT NULL default '0',
 `icone` tinyint(4) unsigned NOT NULL default '0',
 `numreponse` bigint(20) unsigned NOT NULL auto_increment,
@@ -37,7 +36,7 @@ KEY `date` (`date`),
 KEY `pseudo` (`pseudo`),
 KEY `numreponse` (`numreponse`)
 ) TYPE=MyISAM;
-CREATE TABLE `crash2` (
+CREATE TABLE `t2` (
 `numeropost` bigint(20) unsigned NOT NULL default '0',
 `icone` tinyint(4) unsigned NOT NULL default '0',
 `numreponse` bigint(20) unsigned NOT NULL auto_increment,
@@ -52,22 +51,20 @@ KEY `date` (`date`),
 KEY `pseudo` (`pseudo`),
 KEY `numreponse` (`numreponse`)
 ) TYPE=MyISAM;
-INSERT INTO crash2
+INSERT INTO t2
 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
 (9,1,56,'test','joce','2001-07-25 13:50:53'
 ,3649052399,0);
-INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
-SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
 WHERE numeropost=9 ORDER BY numreponse ASC;
 show variables like '%bulk%';
 Variable_name	Value
 bulk_insert_buffer_size	8388608
-INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
-SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
 WHERE numeropost=9 ORDER BY numreponse ASC;
-DROP TABLE IF EXISTS crash1,crash2;
-drop table if exists t1;
-drop table if exists t2;
+DROP TABLE t1,t2;
 create table t1(a int, unique(a));
 insert into t1 values(2);
 create table t2(a int);
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 81266f6562..8f3f82201c 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -659,3 +659,11 @@ i	i	i
 1	NULL	NULL
 2	2	2
 drop table t1,t2,t3;
+create table t1 (f1 integer,f2 integer,f3 integer);
+create table t2 (f2 integer,f4 integer);
+create table t3 (f3 integer,f5 integer);
+select * from t1
+left outer join t2 using (f2)
+left outer join t3 using (f3);
+Unknown column 'test.t2.f3' in 'on clause'
+drop table t1,t2,t3;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 695f891f67..3b51168269 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -12,13 +12,13 @@ insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
 insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
 select * from t2;
 drop table t1,t2;
+
 #
 # bug in bulk insert optimization
 # test case by Fournier Jocelyn <joc@presence-pc.com>
 #
 
-DROP TABLE IF EXISTS crash1,crash2;
-CREATE TABLE `crash1` (
+CREATE TABLE `t1` (
   `numeropost` bigint(20) unsigned NOT NULL default '0',
   `icone` tinyint(4) unsigned NOT NULL default '0',
   `numreponse` bigint(20) unsigned NOT NULL auto_increment,
@@ -34,7 +34,7 @@ CREATE TABLE `crash1` (
   KEY `numreponse` (`numreponse`)
 ) TYPE=MyISAM;
 
-CREATE TABLE `crash2` (
+CREATE TABLE `t2` (
   `numeropost` bigint(20) unsigned NOT NULL default '0',
   `icone` tinyint(4) unsigned NOT NULL default '0',
   `numreponse` bigint(20) unsigned NOT NULL auto_increment,
@@ -50,30 +50,27 @@ CREATE TABLE `crash2` (
   KEY `numreponse` (`numreponse`)
 ) TYPE=MyISAM;
 
-INSERT INTO crash2
+INSERT INTO t2
 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
 (9,1,56,'test','joce','2001-07-25 13:50:53'
 ,3649052399,0);
 
 
-INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
-SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
 WHERE numeropost=9 ORDER BY numreponse ASC;
 
 show variables like '%bulk%';
 
-INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip)
-SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2
+INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
+SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
 WHERE numeropost=9 ORDER BY numreponse ASC;
 
-DROP TABLE IF EXISTS crash1,crash2;
-
+DROP TABLE t1,t2;
 
-# Addendum by Guilhem:
 # Check if a partly-completed INSERT SELECT in a MyISAM table goes
 # into the binlog
-drop table if exists t1;
-drop table if exists t2;
+
 create table t1(a int, unique(a));
 insert into t1 values(2);
 create table t2(a int);
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index e172d54194..ee7d55d2a4 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -425,3 +425,15 @@ insert into t2 values(2),(3);
 insert into t3 values(2),(4);
 select * from t1 natural left join t2 natural left join t3;
 drop table t1,t2,t3;
+
+#
+# Test of USING
+#
+create table t1 (f1 integer,f2 integer,f3 integer);
+create table t2 (f2 integer,f4 integer);
+create table t3 (f3 integer,f5 integer);
+--error 1054
+select * from t1
+         left outer join t2 using (f2)
+         left outer join t3 using (f3);
+drop table t1,t2,t3;
diff --git a/sql/slave.cc b/sql/slave.cc
index fe668900da..851c6ba4f0 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2146,8 +2146,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
   DBUG_ASSERT(rli->sql_thd==thd);
   if (sql_slave_killed(thd,rli))
   {
-    /* do not forget to free ev ! */
-    if (ev) delete ev;
+    delete ev;
     return 1;
   }
   if (ev)
-- 
2.30.9