1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-35437 Suppress "This function has the same name" warnings in I_S queries

Sending "This function has the same name" during I_S quries was too verbose.
Suppressing these warnings.

Now warnings are sent only during CREATE FUNCTION and during function call.
This commit is contained in:
Alexander Barkov
2024-11-18 14:41:03 +04:00
parent eff9c198e3
commit f24d08df96
3 changed files with 70 additions and 1 deletions

View File

@@ -7174,6 +7174,27 @@ int store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
}
/*
Suppress "This function 'func' has the same name as a native function"
during INFORMATION_SCHEMA.ROUTINES queries.
*/
class Native_fct_name_collision_error_handler : public Internal_error_handler
{
public:
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
Sql_condition::enum_warning_level *level,
const char* msg,
Sql_condition ** cond_hdl) override
{
if (sql_errno == ER_NATIVE_FCT_NAME_COLLISION)
return true;
return false;
}
};
int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
{
TABLE *proc_table;
@@ -7184,6 +7205,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
char definer[USER_HOST_BUFF_SIZE];
enum enum_schema_tables schema_table_idx=
get_schema_table_idx(tables->schema_table);
Native_fct_name_collision_error_handler err_handler;
DBUG_ENTER("fill_schema_proc");
strxmov(definer, thd->security_ctx->priv_user, "@",
@@ -7254,7 +7276,8 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
if (res)
goto err;
thd->push_internal_handler(&err_handler);
res= schema_table_idx == SCH_PROCEDURES ?
store_schema_proc(thd, table, proc_table, &lookup, full_access,definer) :
store_schema_params(thd, table, proc_table, &lookup, full_access, definer);
@@ -7264,6 +7287,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
store_schema_proc(thd, table, proc_table, &lookup, full_access, definer) :
store_schema_params(thd, table, proc_table, &lookup, full_access, definer);
}
thd->pop_internal_handler();
err:
if (proc_table->file->inited)