-
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.
fd3c6b18