summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-02-28 20:21:21 +0300
committerunknown <sergefp@mysql.com>2005-02-28 20:21:21 +0300
commitd2ead18b69716bdd1e5610e666e26d1ae1d72197 (patch)
treeba005340f90d790301175ebd1a679b54130e67a8 /mysql-test
parent79cdcc7bb323d3da3bf1948f8932aaab88d513f4 (diff)
downloadmariadb-git-d2ead18b69716bdd1e5610e666e26d1ae1d72197.tar.gz
Fix for BUG#8726: In JOIN::optimize on ER_TOO_BIG_SELECT error set JOIN::error to -1 to cause
the error to be sent to the client. mysql-test/r/select_safe.result: Testcase for BUG#8726 mysql-test/t/select_safe.test: Testcase for BUG#8726 sql/sql_select.cc: Fix for BUG#8726: On ER_TOO_BIG_SELECT set JOIN::error to -1 to cause the error to be sent to the client.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/select_safe.result15
-rw-r--r--mysql-test/t/select_safe.test20
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result
index 766ee8c0e14..7a29db42dd9 100644
--- a/mysql-test/r/select_safe.result
+++ b/mysql-test/r/select_safe.result
@@ -78,4 +78,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+set local max_join_size=8;
+select * from (select * from t1) x;
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+set local max_join_size=1;
+select * from (select * from t1 a, t1 b) x;
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+set local max_join_size=1;
+select * from (select 1 union select 2 union select 3) x;
+ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
+drop table t1;
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
index 3cafd31a879..5b2dfb00bb7 100644
--- a/mysql-test/t/select_safe.test
+++ b/mysql-test/t/select_safe.test
@@ -66,4 +66,24 @@ SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
+# BUG#8726
+create table t1 (a int);
+insert into t1 values (1),(2),(3),(4),(5);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+
+set local max_join_size=8;
+--error 1104
+select * from (select * from t1) x;
+
+set local max_join_size=1;
+--error 1104
+select * from (select * from t1 a, t1 b) x;
+
+set local max_join_size=1;
+--error 1104
+select * from (select 1 union select 2 union select 3) x;
+drop table t1;
+
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;