Commit a4c66084 authored by malff@lambda.hsd1.co.comcast.net's avatar malff@lambda.hsd1.co.comcast.net

Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-runtime

into  lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge
parents a1978fef f3a64839
...@@ -1763,7 +1763,7 @@ drop procedure bug15091; ...@@ -1763,7 +1763,7 @@ drop procedure bug15091;
drop function if exists bug16896; drop function if exists bug16896;
--enable_warnings --enable_warnings
--error ER_SP_NO_AGGREGATE --error ER_PARSE_ERROR
create aggregate function bug16896() returns int return 1; create aggregate function bug16896() returns int return 1;
# #
...@@ -2199,6 +2199,29 @@ BEGIN ...@@ -2199,6 +2199,29 @@ BEGIN
END| END|
--delimiter ; --delimiter ;
#
# Bug#29816 Syntactically wrong query fails with misleading error message
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest;
--enable_warnings
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
SELECT inexistent(), 1 + ,;
--error ER_SP_DOES_NOT_EXIST
SELECT inexistent();
--error ER_PARSE_ERROR
SELECT .inexistent();
--error ER_PARSE_ERROR
SELECT ..inexistent();
USE test;
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
......
...@@ -113,11 +113,11 @@ DROP TABLE bug19904; ...@@ -113,11 +113,11 @@ DROP TABLE bug19904;
# Bug#21269: DEFINER-clause is allowed for UDF-functions # Bug#21269: DEFINER-clause is allowed for UDF-functions
# #
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
RETURNS STRING SONAME "should_not_parse.so"; RETURNS STRING SONAME "should_not_parse.so";
--error ER_WRONG_USAGE --error ER_PARSE_ERROR
CREATE DEFINER=someone@somewhere FUNCTION should_not_parse CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
RETURNS STRING SONAME "should_not_parse.so"; RETURNS STRING SONAME "should_not_parse.so";
# #
...@@ -363,6 +363,20 @@ drop table t1; ...@@ -363,6 +363,20 @@ drop table t1;
drop function metaphon; drop function metaphon;
set GLOBAL query_cache_size=default; set GLOBAL query_cache_size=default;
#
# Bug#28318 CREATE FUNCTION (UDF) requires a schema
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest;
--enable_warnings
CREATE DATABASE mysqltest;
USE mysqltest;
DROP DATABASE mysqltest;
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
DROP FUNCTION metaphon;
USE test;
# #
# Bug #29804 UDF parameters don't contain correct string length # Bug #29804 UDF parameters don't contain correct string length
......
...@@ -1591,12 +1591,12 @@ static bool add_used_routine(LEX *lex, Query_arena *arena, ...@@ -1591,12 +1591,12 @@ static bool add_used_routine(LEX *lex, Query_arena *arena,
{ {
Sroutine_hash_entry *rn= Sroutine_hash_entry *rn=
(Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry) + (Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry) +
key->length); key->length + 1);
if (!rn) // OOM. Error will be reported using fatal_error(). if (!rn) // OOM. Error will be reported using fatal_error().
return FALSE; return FALSE;
rn->key.length= key->length; rn->key.length= key->length;
rn->key.str= (char *)rn + sizeof(Sroutine_hash_entry); rn->key.str= (char *)rn + sizeof(Sroutine_hash_entry);
memcpy(rn->key.str, key->str, key->length); memcpy(rn->key.str, key->str, key->length + 1);
my_hash_insert(&lex->sroutines, (uchar *)rn); my_hash_insert(&lex->sroutines, (uchar *)rn);
lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next); lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next);
rn->belong_to_view= belong_to_view; rn->belong_to_view= belong_to_view;
...@@ -1779,7 +1779,7 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex, ...@@ -1779,7 +1779,7 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex,
for (Sroutine_hash_entry *rt= start; rt; rt= rt->next) for (Sroutine_hash_entry *rt= start; rt; rt= rt->next)
{ {
sp_name name(rt->key.str, rt->key.length); sp_name name(thd, rt->key.str, rt->key.length);
int type= rt->key.str[0]; int type= rt->key.str[0];
sp_head *sp; sp_head *sp;
...@@ -1787,13 +1787,6 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex, ...@@ -1787,13 +1787,6 @@ sp_cache_routines_and_add_tables_aux(THD *thd, LEX *lex,
&thd->sp_func_cache : &thd->sp_proc_cache), &thd->sp_func_cache : &thd->sp_proc_cache),
&name))) &name)))
{ {
name.m_name.str= strchr(name.m_qname.str, '.');
name.m_db.length= name.m_name.str - name.m_qname.str;
name.m_db.str= strmake_root(thd->mem_root, name.m_qname.str,
name.m_db.length);
name.m_name.str+= 1;
name.m_name.length= name.m_qname.length - name.m_db.length - 1;
switch ((ret= db_find_routine(thd, type, &name, &sp))) switch ((ret= db_find_routine(thd, type, &name, &sp)))
{ {
case SP_OK: case SP_OK:
......
...@@ -129,16 +129,7 @@ class sp_name : public Sql_alloc ...@@ -129,16 +129,7 @@ class sp_name : public Sql_alloc
Creates temporary sp_name object from key, used mainly Creates temporary sp_name object from key, used mainly
for SP-cache lookups. for SP-cache lookups.
*/ */
sp_name(char *key, uint key_len) sp_name(THD *thd, char *key, uint key_len);
{
m_sroutines_key.str= key;
m_sroutines_key.length= key_len;
m_name.str= m_qname.str= key + 1;
m_name.length= m_qname.length= key_len - 1;
m_db.str= 0;
m_db.length= 0;
m_explicit_name= false;
}
// Init. the qualified name from the db and name. // Init. the qualified name from the db and name.
void init_qname(THD *thd); // thd for memroot allocation void init_qname(THD *thd); // thd for memroot allocation
......
...@@ -3357,12 +3357,6 @@ mysql_execute_command(THD *thd) ...@@ -3357,12 +3357,6 @@ mysql_execute_command(THD *thd)
if (check_access(thd,INSERT_ACL,"mysql",0,1,0,0)) if (check_access(thd,INSERT_ACL,"mysql",0,1,0,0))
break; break;
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
if (sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
&thd->sp_func_cache, FALSE))
{
my_error(ER_UDF_EXISTS, MYF(0), lex->spname->m_name.str);
goto error;
}
if (!(res = mysql_create_function(thd, &lex->udf))) if (!(res = mysql_create_function(thd, &lex->udf)))
send_ok(thd); send_ok(thd);
#else #else
......
...@@ -415,7 +415,7 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -415,7 +415,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (check_string_char_length(&udf->name, "", NAME_CHAR_LEN, if (check_string_char_length(&udf->name, "", NAME_CHAR_LEN,
system_charset_info, 1)) system_charset_info, 1))
{ {
my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name); my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name.str);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -429,7 +429,7 @@ int mysql_create_function(THD *thd,udf_func *udf) ...@@ -429,7 +429,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
rw_wrlock(&THR_LOCK_udf); rw_wrlock(&THR_LOCK_udf);
if ((hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length))) if ((hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length)))
{ {
my_error(ER_UDF_EXISTS, MYF(0), udf->name); my_error(ER_UDF_EXISTS, MYF(0), udf->name.str);
goto err; goto err;
} }
if (!(dl = find_udf_dl(udf->dl))) if (!(dl = find_udf_dl(udf->dl)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment