summaryrefslogtreecommitdiff
path: root/mysql-test/t/select.test
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-08-03 01:58:21 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-08-03 01:58:21 +0500
commit45b4a7e3392fde8362c785b40dce3a6a55f49773 (patch)
tree47296516b38e3c9b2c7c5042a7374083dfbb1207 /mysql-test/t/select.test
parenta91df80c73e8e9698e9423ad39dba2130d4b42c1 (diff)
downloadmariadb-git-45b4a7e3392fde8362c785b40dce3a6a55f49773.tar.gz
Fixed bug #27352.
The SELECT query with more than 31 nested dependent SELECT queries returned wrong result. New error message has been added: ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT. It will be reported as: "Too high level of nesting for select". sql/sql_parse.cc: Fixed bug #27352. The Item_sum::register_sum_func method has been modified to return TRUE on exceeding of allowed level of SELECT nesting and to report corresponding error message. sql/unireg.h: Fixed bug #27352. Constant definition has been added: maximal allowed level of SELECT nesting. mysql-test/t/select.test: Updated test case for bug #27352. mysql-test/r/select.result: Updated test case for bug #27352. sql/share/errmsg.txt: Fixed bug #27352. New error message has been added: ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT.
Diffstat (limited to 'mysql-test/t/select.test')
-rw-r--r--mysql-test/t/select.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 56b2f1b02b8..8bfa12539fa 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3370,4 +3370,34 @@ EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
DROP TABLE t1;
+#
+# Bug #27352: Incorrect result of nested selects instead of error reporting
+#
+
+CREATE TABLE t1 (c1 INT, c2 INT);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+
+let $n= 31;
+let $q= COUNT(c2);
+while ($n)
+{
+ let $q= (SELECT $q);
+ dec $n;
+}
+--disable_warnings
+eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
+--enable_warnings
+
+let $n= 64;
+let $q= COUNT(c2);
+while ($n)
+{
+ let $q= (SELECT $q);
+ dec $n;
+}
+--error ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
+eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests