summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-02-10 11:58:19 +0200
committerGeorgi Kodinov <joro@sun.com>2009-02-10 11:58:19 +0200
commit0669b79363b940c4673d972d1fa8142c2d3e0823 (patch)
tree287d07737bc4b77b4aee406f31b4691384f27bd5
parent06e185280a4c2b6bae6f4b1b5a66947a49a449bd (diff)
downloadmariadb-git-0669b79363b940c4673d972d1fa8142c2d3e0823.tar.gz
Bug #33813: Schema names are case-sensitive in DROP FUNCTION
The parser was not using the correct fully-qualified-name production for DROP FUNCTION. Fixed by copying the production from DROP PROCEDURE. Tested in the windows specific suite to make sure it's tested on a case-insensitive file system. mysql-test/r/windows.result: Bug #33813: test case mysql-test/t/windows.test: Bug #33813: test case sql/sql_yacc.yy: Bug #33813: use the correct production for the name in DROP PROCEDURE
-rw-r--r--mysql-test/r/windows.result18
-rwxr-xr-xmysql-test/t/windows.test31
-rw-r--r--sql/sql_yacc.yy33
3 files changed, 52 insertions, 30 deletions
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index 5a54db8bb84..43ba878b9a5 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -19,4 +19,22 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
DROP TABLE t1;
+CREATE DATABASE `TESTDB`;
+USE `TESTDB`;
+CREATE FUNCTION test_fn() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+CREATE FUNCTION test_fn2() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+DROP FUNCTION `TESTDB`.`test_fn`;
+DROP FUNCTION `testdb`.`test_fn2`;
+USE test;
+DROP DATABASE `TESTDB`;
End of 5.0 tests.
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index 6e6a7ec93a3..adaf8d3ea17 100755
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
@@ -35,4 +35,35 @@ CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
DROP TABLE t1;
+#
+# Bug #33813: Schema names are case-sensitive in DROP FUNCTION
+#
+
+CREATE DATABASE `TESTDB`;
+
+USE `TESTDB`;
+DELIMITER //;
+
+CREATE FUNCTION test_fn() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+
+CREATE FUNCTION test_fn2() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+
+DELIMITER ;//
+
+DROP FUNCTION `TESTDB`.`test_fn`;
+DROP FUNCTION `testdb`.`test_fn2`;
+
+USE test;
+DROP DATABASE `TESTDB`;
+
--echo End of 5.0 tests.
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0eefe782354..fbaf761cc33 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7507,44 +7507,17 @@ drop:
lex->drop_if_exists=$3;
lex->name=$4.str;
}
- | DROP FUNCTION_SYM if_exists ident '.' ident
+ | DROP FUNCTION_SYM if_exists sp_name
{
- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- sp_name *spname;
- if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
- MYSQL_YYABORT;
- }
- lex->sql_command = SQLCOM_DROP_FUNCTION;
- lex->drop_if_exists= $3;
- spname= new sp_name($4, $6, true);
- if (spname == NULL)
- MYSQL_YYABORT;
- spname->init_qname(thd);
- lex->spname= spname;
- }
- | DROP FUNCTION_SYM if_exists ident
- {
- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- LEX_STRING db= {0, 0};
- sp_name *spname;
+ LEX *lex= Lex;
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
MYSQL_YYABORT;
}
- if (thd->db && lex->copy_db_to(&db.str, &db.length))
- MYSQL_YYABORT;
lex->sql_command = SQLCOM_DROP_FUNCTION;
lex->drop_if_exists= $3;
- spname= new sp_name(db, $4, false);
- if (spname == NULL)
- MYSQL_YYABORT;
- spname->init_qname(thd);
- lex->spname= spname;
+ lex->spname= $4;
}
| DROP PROCEDURE if_exists sp_name
{