summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-error.test
diff options
context:
space:
mode:
authorunknown <davi@moksha.com.br>2007-10-11 17:38:40 -0300
committerunknown <davi@moksha.com.br>2007-10-11 17:38:40 -0300
commit03e74b8c5ea1764cb4f74e386d2a6ba4416e2e07 (patch)
treed8dbb8add9258a252605f7fb96841d15388a06ba /mysql-test/t/sp-error.test
parent3ca34c102a363d41ce7ee7de2a15de288654e967 (diff)
downloadmariadb-git-03e74b8c5ea1764cb4f74e386d2a6ba4416e2e07.tar.gz
Bug#29223 declare cursor c for SHOW .....
"DECLARE CURSOR FOR SHOW ..." is a syntax that currently appears to work, but is untested for some SHOW commands and does not work for other SHOW commands. Since this is an un-intended feature that leaked as a result of a coding bug (in the parser grammar), the correct fix is to fix the grammar to not accept this construct. In other words, "DECLARE CURSOR FOR SHOW <other commands that don't work>" is not considered a bug, and we will not implement other features to make all the SHOW commands usable inside a cursor just because someone exploited a bug. mysql-test/r/sp-error.result: Only allow declaring cursors for SELECT statements to avoid possible further confusion/problems. mysql-test/t/information_schema.test: Only SELECT statements are allowed in cursors. mysql-test/t/sp-error.test: Add test case for Bug#29223. Non-SELECT statements in cursors now yields a parser error. sql/sql_yacc.yy: Rework DECLARE CURSOR statement to not allow non-SELECT statements.
Diffstat (limited to 'mysql-test/t/sp-error.test')
-rw-r--r--mysql-test/t/sp-error.test23
1 files changed, 22 insertions, 1 deletions
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index c9145859405..ad516f028e6 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -196,7 +196,7 @@ select f(10)|
drop function f|
---error 1322
+--error ER_PARSE_ERROR
create procedure p()
begin
declare c cursor for insert into test.t1 values ("foo", 42);
@@ -2179,6 +2179,27 @@ delimiter ;//
#
+# Bug#29223 declare cursor c for SHOW .....
+#
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+--delimiter |
+--error ER_PARSE_ERROR
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE c char(100);
+ DECLARE cur1 CURSOR FOR SHOW TABLES;
+
+ OPEN cur1;
+ FETCH cur1 INTO c;
+ select c;
+ CLOSE cur1;
+END|
+--delimiter ;
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings