MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:marc.alff Date:July 29 2006 4:47am
Subject:bk commit into 5.0 tree (malff:1.2243) BUG#21269
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marcsql. When marcsql does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-07-28 21:46:58-07:00, malff@weblab.(none) +3 -0
  Bug#21269 (DEFINER-clause is allowed for UDF-functions)
  
  The problem was that the grammar allows to create a function with an optional
  definer clause, and define it as a UDF with the SONAME keyword.
  Such combination should be reported as an error.
  
  The solution is to not change the grammar itself, and to introduce a
  specific check in the yacc actions in 'create_function_tail' for UDF,
  that now reports ER_WRONG_USAGE when using both DEFINER and SONAME.

  mysql-test/r/udf.result@stripped, 2006-07-28 21:46:56-07:00, malff@weblab.(none) +6 -0
    Added tests for Bug#21269 (DEFINER-clause is allowed for UDF-functions)

  mysql-test/t/udf.test@stripped, 2006-07-28 21:46:56-07:00, malff@weblab.(none) +12 -0
    Added tests for Bug#21269 (DEFINER-clause is allowed for UDF-functions)

  sql/sql_yacc.yy@stripped, 2006-07-28 21:46:56-07:00, malff@weblab.(none) +11 -0
    Creating a UDF function with a DEFINER clause is now a syntax error.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	malff
# Host:	weblab.(none)
# Root:	/home/marcsql/TREE/mysql-5.0-21269

--- 1.476/sql/sql_yacc.yy	2006-07-28 21:47:02 -07:00
+++ 1.477/sql/sql_yacc.yy	2006-07-28 21:47:02 -07:00
@@ -1256,6 +1256,17 @@ create_function_tail:
 	  RETURNS_SYM udf_type UDF_SONAME_SYM TEXT_STRING_sys
 	  {
 	    LEX *lex=Lex;
+            if (lex->definer != NULL)
+            {
+              /*
+                 DEFINER is a concept meaningful when interpreting SQL code.
+                 UDF functions are compiled.
+                 Using DEFINER with UDF has therefore no semantic,
+                 and is considered a parsing error.
+              */
+	      my_error(ER_WRONG_USAGE, MYF(0), "SONAME", "DEFINER");
+              YYABORT;
+            }
 	    lex->sql_command = SQLCOM_CREATE_FUNCTION;
 	    lex->udf.name = lex->spname->m_name;
 	    lex->udf.returns=(Item_result) $2;

--- 1.5/mysql-test/r/udf.result	2006-07-28 21:47:02 -07:00
+++ 1.6/mysql-test/r/udf.result	2006-07-28 21:47:02 -07:00
@@ -93,6 +93,12 @@ NULL
 0R
 FR
 DROP TABLE bug19904;
+CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
+RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+ERROR HY000: Incorrect usage of SONAME and DEFINER
+CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
+RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+ERROR HY000: Incorrect usage of SONAME and DEFINER
 End of 5.0 tests.
 DROP FUNCTION metaphon;
 DROP FUNCTION myfunc_double;

--- 1.5/mysql-test/t/udf.test	2006-07-28 21:47:02 -07:00
+++ 1.6/mysql-test/t/udf.test	2006-07-28 21:47:02 -07:00
@@ -109,6 +109,18 @@ SELECT myfunc_double(n) AS f FROM bug199
 SELECT metaphon(v) AS f FROM bug19904;
 DROP TABLE bug19904;
 
+#
+# Bug#21269: DEFINER-clause is allowed for UDF-functions
+#
+
+--error ER_WRONG_USAGE
+CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
+RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+
+--error ER_WRONG_USAGE
+CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
+RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+
 --echo End of 5.0 tests.
 
 #
Thread
bk commit into 5.0 tree (malff:1.2243) BUG#21269marc.alff29 Jul