summaryrefslogtreecommitdiff
path: root/sql/sp_head.h
diff options
context:
space:
mode:
authordavi@virtua-cwbas201-21-158-74.ctb.virtua.com.br <>2007-10-09 20:46:33 -0300
committerdavi@virtua-cwbas201-21-158-74.ctb.virtua.com.br <>2007-10-09 20:46:33 -0300
commitfd3c6b185515bc6a0ea8598e98531c5f8b326502 (patch)
treef3f7438416dcb6b9a5fca1af52cd41c113252566 /sql/sp_head.h
parentf4b671d8bc1ab80342918820a2bc841c5542d57d (diff)
downloadmariadb-git-fd3c6b185515bc6a0ea8598e98531c5f8b326502.tar.gz
Bug#28318 CREATE FUNCTION (UDF) requires a schema
Bug#29816 Syntactically wrong query fails with misleading error message The core problem is that an SQL-invoked function name can be a <schema qualified routine name> that contains no <schema name>, but the mysql parser insists that all stored procedures (function, procedures and triggers) must have a <schema name>, which is not true for functions. This problem is especially visible when trying to create a function or when a query contains a syntax error after a function call (in the same query), both will fail with a "No database selected" message if the session is not attached to a particular schema, but the first one should succeed and the second fail with a "syntax error" message. Part of the fix is to revamp the sp name handling so that a schema name may be omitted for functions -- this means that the internal function name representation may not have a dot, which represents that the function doesn't have a schema name. The other part is to place schema checks after the type (function, trigger or procedure) of the routine is known.
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r--sql/sp_head.h11
1 files changed, 1 insertions, 10 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h
index ebe40ce9c87..7d042367985 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -72,16 +72,7 @@ public:
Creates temporary sp_name object from key, used mainly
for SP-cache lookups.
*/
- sp_name(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;
- }
+ sp_name(THD *thd, char *key, uint key_len);
// Init. the qualified name from the db and name.
void init_qname(THD *thd); // thd for memroot allocation