summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-11-18 23:14:58 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2002-11-18 23:14:58 +0200
commit10de2720aa9de78b461ef4eac1cf45f395994350 (patch)
tree89fa070567f9e5ebe7c572dbbf03d8d56d62757b
parentfb23575c7ac4511d6a3e6ab09a9af3c08e00ed36 (diff)
parent3a21e244a0c2eedad7a35b575f57ca99e861002f (diff)
downloadmariadb-git-10de2720aa9de78b461ef4eac1cf45f395994350.tar.gz
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
-rw-r--r--mysql-test/r/subselect.result2
-rw-r--r--mysql-test/t/subselect.test3
-rw-r--r--sql/sql_select.cc16
3 files changed, 14 insertions, 7 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index f4341e5dd71..e54e1fb0fef 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -279,6 +279,8 @@ UNIQUE KEY `numreponse` (`numreponse`),
KEY `pseudo` (`pseudo`,`numeropost`)
) TYPE=MyISAM;
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
+Subselect returns more than 1 record
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Select tables optimized away
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index a81b3f62945..7a507be4ed2 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -177,7 +177,8 @@ CREATE TABLE `threadhardwarefr7` (
KEY `pseudo` (`pseudo`,`numeropost`)
) TYPE=MyISAM;
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
-
+-- error 1240
+EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1');
drop table if exists threadhardwarefrtest7;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index db3acfba909..b596d27b5af 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -372,13 +372,17 @@ JOIN::optimize()
}
#endif
- conds=optimize_cond(conds,&cond_value);
- if (thd->fatal_error || thd->net.report_error)
+ conds= optimize_cond(conds,&cond_value);
+ if (thd->fatal_error)
{
+ // quick abort
delete procedure;
- error = 0;
+ error= 0;
DBUG_RETURN(1);
- }
+ } else if (thd->net.report_error)
+ // normal error processing & cleanup
+ DBUG_RETURN(-1);
+
if (cond_value == Item::COND_FALSE || (!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */
zero_result_cause= "Impossible WHERE";
@@ -7520,8 +7524,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
break;
}
- if (res > 0)
- res= -res; // mysql_explain_select do not report error
+ if (res > 0 || thd->net.report_error)
+ res= -1; // mysql_explain_select do not report error
DBUG_RETURN(res);
}