summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authormalff/marcsql@weblab.(none) <>2006-07-31 12:01:43 -0700
committermalff/marcsql@weblab.(none) <>2006-07-31 12:01:43 -0700
commitab86e0b3cba9366bd2df3f35ef3cfc1651cd9217 (patch)
tree2228c91fd6fee9330384562dc7890e64d5f9d0a5 /sql
parentb7f403b546b83f40ff48479c9dd909e38ae9eb26 (diff)
downloadmariadb-git-ab86e0b3cba9366bd2df3f35ef3cfc1651cd9217.tar.gz
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.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_yacc.yy11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a92d19ee58d..d497678cec3 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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;