summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-05-27 18:19:44 +0300
committerGeorgi Kodinov <joro@sun.com>2009-05-27 18:19:44 +0300
commitc675beab98d90e2f1a606c17d106740d1394071a (patch)
treeef20b1214af011ce8ef6a3fb904fb115e723cb71 /sql
parentc8a7b7914203a95c30ce45e800f7676744248bf7 (diff)
parent80730df7d634e1a620c864d6665d6e66ccad447a (diff)
downloadmariadb-git-c675beab98d90e2f1a606c17d106740d1394071a.tar.gz
merged 5.0-bugteam to 5.1-bugteam
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc10
-rw-r--r--sql/share/errmsg.txt3
-rw-r--r--sql/sql_derived.cc1
-rw-r--r--sql/sql_lex.cc10
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/table.cc1
6 files changed, 26 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 0c8f236a27c..85e5de7b980 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -5802,6 +5802,14 @@ Item_func_sp::func_name() const
}
+int my_missing_function_error(const LEX_STRING &token, const char *func_name)
+{
+ if (token.length && is_lex_native_function (&token))
+ return my_error(ER_FUNC_INEXISTENT_NAME_COLLISION, MYF(0), func_name);
+ else
+ return my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", func_name);
+}
+
/**
@brief Initialize the result field by creating a temporary dummy table
@@ -5834,7 +5842,7 @@ Item_func_sp::init_result_field(THD *thd)
if (!(m_sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, m_name,
&thd->sp_func_cache, TRUE)))
{
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", m_name->m_qname.str);
+ my_missing_function_error (m_name->m_name, m_name->m_qname.str);
context->process_error(thd);
DBUG_RETURN(TRUE);
}
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 2dfc5310643..7c92c827c87 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -6177,3 +6177,6 @@ ER_TOO_LONG_TABLE_COMMENT
ER_TOO_LONG_FIELD_COMMENT
eng "Comment for field '%-.64s' is too long (max = %lu)"
por "Comentário para o campo '%-.64s' é longo demais (max = %lu)"
+
+ER_FUNC_INEXISTENT_NAME_COLLISION 42000
+ eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual"
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 41be98621a6..37adf5c403a 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -179,6 +179,7 @@ exit:
{
if (thd->is_error() &&
(thd->main_da.sql_errno() == ER_BAD_FIELD_ERROR ||
+ thd->main_da.sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
thd->main_da.sql_errno() == ER_SP_DOES_NOT_EXIST))
{
thd->clear_error();
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index b96ac91679b..03da3c2338a 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -433,6 +433,16 @@ bool is_keyword(const char *name, uint len)
return get_hash_symbol(name,len,0)!=0;
}
+/**
+ Check if name is a sql function
+
+ @param name checked name
+
+ @return is this a native function or not
+ @retval 0 name is a function
+ @retval 1 name isn't a function
+*/
+
bool is_lex_native_function(const LEX_STRING *name)
{
DBUG_ASSERT(name != NULL);
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 62106a2500b..22b7d2e359c 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1976,4 +1976,6 @@ extern bool is_lex_native_function(const LEX_STRING *name);
@} (End of group Semantic_Analysis)
*/
+int my_missing_function_error(const LEX_STRING &token, const char *name);
+
#endif /* MYSQL_SERVER */
diff --git a/sql/table.cc b/sql/table.cc
index 066bbc953fa..7e8d5ac98b4 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3341,6 +3341,7 @@ void TABLE_LIST::hide_view_error(THD *thd)
if (thd->main_da.sql_errno() == ER_BAD_FIELD_ERROR ||
thd->main_da.sql_errno() == ER_SP_DOES_NOT_EXIST ||
+ thd->main_da.sql_errno() == ER_FUNC_INEXISTENT_NAME_COLLISION ||
thd->main_da.sql_errno() == ER_PROCACCESS_DENIED_ERROR ||
thd->main_da.sql_errno() == ER_COLUMNACCESS_DENIED_ERROR ||
thd->main_da.sql_errno() == ER_TABLEACCESS_DENIED_ERROR ||