List:Commits« Previous MessageNext Message »
From:Nisha Gopalakrishnan Date:June 28 2012 10:48am
Subject:bzr push into mysql-trunk branch (nisha.gopalakrishnan:3919 to 3920)
Bug#13864485
View as plain text  
 3920 Nisha Gopalakrishnan	2012-06-28
      Bug#13864485: BAD ERROR MESSAGE WITH STORED FUNCTIONS IF NO
                    DEFAULT DATABASE
      
      Analysis:
      --------
      
      When no default database is selected, the error reported for the
      execution of stored function is incorrect. Error ER_SP_DOES_NOT_EXIST
      is reported instead of ER_NO_DB_ERROR.
      
      Fix
      ---
      Changed the error message reported from ER_SP_DOES_NOT_EXIST(Stored
      procedure does not exist) to ER_NO_DB_ERROR(No database selected)
      when a stored function is invoked without a default database set.
      In addition removed the sphead NULL check since the scenario where
      the sphead is valid and the database selected is NULL is invalid for
      stored functions.

    modified:
      mysql-test/r/sp-error.result
      mysql-test/t/sp-error.test
      sql/item_create.cc
 3919 Joerg Bruehe	2012-06-28 [merge]
      Null upmerge of a nick change in 5.6

=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result	2011-12-12 12:55:18 +0000
+++ b/mysql-test/r/sp-error.result	2012-06-28 10:46:42 +0000
@@ -1494,9 +1494,9 @@ CREATE DATABASE mysqltest;
 USE mysqltest;
 DROP DATABASE mysqltest;
 SELECT inexistent(), 1 + ,;
-ERROR 42000: FUNCTION inexistent does not exist
+ERROR 3D000: No database selected
 SELECT inexistent();
-ERROR 42000: FUNCTION inexistent does not exist
+ERROR 3D000: No database selected
 SELECT .inexistent();
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '()' at line 1
 SELECT ..inexistent();

=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test	2011-12-12 12:55:18 +0000
+++ b/mysql-test/t/sp-error.test	2012-06-28 10:46:42 +0000
@@ -2152,12 +2152,13 @@ DROP DATABASE IF EXISTS mysqltest;
 CREATE DATABASE mysqltest;
 USE mysqltest;
 DROP DATABASE mysqltest;
-# Both ER_SP_DOES_NOT_EXIST and ER_PARSE_ERROR are valid here,
-# the result is implementation dependent:
-# See Bug#29816 for details
---error ER_SP_DOES_NOT_EXIST
+# Both ER_SP_DOES_NOT_EXIST and ER_PARSE_ERROR are valid here, the result is
+# implementation dependent: See Bug#29816 for details.  
+# ER_SP_DOES_NOT_EXIST has been replaced by ER_NO_DB_ERROR since it is valid in
+# this scenario. See Bug# 13864485 for details.
+--error ER_NO_DB_ERROR 
 SELECT inexistent(), 1 + ,;
---error ER_SP_DOES_NOT_EXIST
+--error ER_NO_DB_ERROR
 SELECT inexistent();
 --error ER_PARSE_ERROR
 SELECT .inexistent();

=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc	2012-06-19 09:26:13 +0000
+++ b/sql/item_create.cc	2012-06-28 10:46:42 +0000
@@ -2695,21 +2695,10 @@ Create_qfunc::create_func(THD *thd, LEX_
 {
   LEX_STRING db;
 
-  if (! thd->db && ! thd->lex->sphead)
+  /* Cannot match the function since no database is selected */
+  if (thd->db == NULL)
   {
-    /*
-      The proper error message should be in the lines of:
-        Can't resolve <name>() to a function call,
-        because this function:
-        - is not a native function,
-        - is not a user defined function,
-        - can not match a qualified (read: stored) function
-          since no database is selected.
-      Reusing ER_SP_DOES_NOT_EXIST have a message consistent with
-      the case when a default database exist, see Create_sp_func::create().
-    */
-    my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
-             "FUNCTION", name.str);
+    my_error(ER_NO_DB_ERROR, MYF(0));
     return NULL;
   }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (nisha.gopalakrishnan:3919 to 3920)Bug#13864485Nisha Gopalakrishnan28 Jun