List:Commits« Previous MessageNext Message »
From:Dmitry Shulga Date:May 27 2011 7:06am
Subject:bzr commit into mysql-5.1 branch (Dmitry.Shulga:3625) Bug#60347 Bug#11840395
View as plain text  
#At file:///Users/shulga/projects/mysql/mysql-5.1-bug11840395/ based on revid:vasil.dimov@stripped

 3625 Dmitry Shulga	2011-05-27
      Fixed bug#11840395 (formerly known as bug#60347): THE STRING "VERSIONDATA"
      SEEMS TO BE 'LEAKING' INTO THE SCHEMA NAME SPACE.
      
      The problem was that if you create a stored function at a schema that have
      uppercase letters in its name AND --lower_case_table_names is equal to
      either 1 or 2, then when you try to call this stored function like such a way
      select someMixedCaseDb.my_function_name(); 
      you will got error like this 
      ERROR 1305 (42000): FUNCTION someMixedCaseDb.my_function_name does not exist
      
      The reason for this bug is that when a stored function is being created
      its name schema name is converted to lowercase if the value of option
      --lower_case_table_names is not equal to 0. However, this conversion
      isn't done when this stored function called by fully qualified name
      (i.e. in manner as schema_name.function_name). For stored procedures
      all is ok since during parsing clause 'call schemaName.sp_name()'
      schema name converted to lowercase.
      
      The solution is to convert stored function name to lowercase when it called
      and the value of option lower_case_table_names  is not equal to 0.
     @ mysql-test/r/parser.result
        Added result for testcase for bug#11840395.
     @ mysql-test/t/parser.test
        Added testcase for bug#11840395.
     @ sql/sql_yacc.yy
        Processing for rule for 'function_call_generic:' was modified:
        add call to check_db_name() when handling token
        ident '.' ident. Function implementation for check_db_name()
        makes convertion of schema name to lowercase as its side effect.

    modified:
      mysql-test/r/parser.result
      mysql-test/t/parser.test
      sql/sql_yacc.yy
=== modified file 'mysql-test/r/parser.result'
--- a/mysql-test/r/parser.result	2009-04-17 20:00:53 +0000
+++ b/mysql-test/r/parser.result	2011-05-27 07:06:17 +0000
@@ -616,5 +616,20 @@ SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn 
 a1	a4
 DROP TABLE t1, t2, t3;
 #
+# Bug#11840395 (formerly known as bug#60347): The string "versiondata" seems to be 'leaking' into the schema name space
+#                                             to be 'leaking' into the schema name space
+#
+DROP DATABASE IF EXISTS mixedCaseDbName;
+CREATE DATABASE mixedCaseDbName;
+CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end
+|
+CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
+|
+call mixedCaseDbName.tryMyProc();
+select mixedCaseDbName.tryMyFunc();
+mixedCaseDbName.tryMyFunc()
+IT WORKS
+DROP DATABASE mixedCaseDbName;
+#
 # End of 5.1 tests
 #

=== modified file 'mysql-test/t/parser.test'
--- a/mysql-test/t/parser.test	2009-04-17 20:00:53 +0000
+++ b/mysql-test/t/parser.test	2011-05-27 07:06:17 +0000
@@ -726,5 +726,23 @@ SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn 
 DROP TABLE t1, t2, t3;
 
 --echo #
+--echo # Bug#11840395 (formerly known as bug#60347): The string "versiondata" seems to be 'leaking' into the schema name space
+--echo #                                             to be 'leaking' into the schema name space
+--echo #
+--disable_warnings
+DROP DATABASE IF EXISTS mixedCaseDbName;
+--enable_warnings
+CREATE DATABASE mixedCaseDbName;
+DELIMITER |;
+CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end
+|
+CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
+|
+DELIMITER ;|
+call mixedCaseDbName.tryMyProc();
+select mixedCaseDbName.tryMyFunc();
+DROP DATABASE mixedCaseDbName;
+
+--echo #
 --echo # End of 5.1 tests
 --echo #

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2010-10-13 05:28:58 +0000
+++ b/sql/sql_yacc.yy	2011-05-27 07:06:17 +0000
@@ -8083,6 +8083,11 @@ function_call_generic:
               version() (a vendor can specify any schema).
             */
 
+            if (!$1.str || check_db_name(&$1))
+            {
+              my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
+              MYSQL_YYABORT;
+            }
             builder= find_qualified_function_builder(thd);
             DBUG_ASSERT(builder);
             item= builder->create(thd, $1, $3, true, $5);


Attachment: [text/bzr-bundle] bzr/dmitry.shulga@oracle.com-20110527070617-5n79pzkdm18cl7a3.bundle
Thread
bzr commit into mysql-5.1 branch (Dmitry.Shulga:3625) Bug#60347 Bug#11840395Dmitry Shulga27 May