mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01: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:
parent
eff9c198e3
commit
f24d08df96
3 changed files with 70 additions and 1 deletions
|
@ -9101,3 +9101,27 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||||
#
|
#
|
||||||
# End of 10.7 tests
|
# End of 10.7 tests
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# Start of 11.8 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# MDEV-35437 Suppress "This function has the same name" warnings in I_S queries
|
||||||
|
#
|
||||||
|
CREATE FUNCTION upper() RETURNS TEXT RETURN 'upper';
|
||||||
|
Warnings:
|
||||||
|
Note 1585 This function 'upper' has the same name as a native function
|
||||||
|
SELECT test.upper();
|
||||||
|
test.upper()
|
||||||
|
upper
|
||||||
|
Warnings:
|
||||||
|
Note 1585 This function 'upper' has the same name as a native function
|
||||||
|
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test' AND ROUTINE_NAME='upper';
|
||||||
|
ROUTINE_NAME
|
||||||
|
upper
|
||||||
|
SELECT SPECIFIC_NAME FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_SCHEMA='test' AND SPECIFIC_NAME='upper';
|
||||||
|
SPECIFIC_NAME
|
||||||
|
upper
|
||||||
|
DROP FUNCTION upper;
|
||||||
|
#
|
||||||
|
# End of 11.8 tests
|
||||||
|
#
|
||||||
|
|
|
@ -10699,3 +10699,24 @@ CREATE PROCEDURE sp() SELECT @;
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.7 tests
|
--echo # End of 10.7 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start of 11.8 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-35437 Suppress "This function has the same name" warnings in I_S queries
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE FUNCTION upper() RETURNS TEXT RETURN 'upper';
|
||||||
|
SELECT test.upper();
|
||||||
|
# I_S queries should not produce warnings
|
||||||
|
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test' AND ROUTINE_NAME='upper';
|
||||||
|
SELECT SPECIFIC_NAME FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_SCHEMA='test' AND SPECIFIC_NAME='upper';
|
||||||
|
DROP FUNCTION upper;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 11.8 tests
|
||||||
|
--echo #
|
||||||
|
|
|
@ -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)
|
int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||||
{
|
{
|
||||||
TABLE *proc_table;
|
TABLE *proc_table;
|
||||||
|
@ -7184,6 +7205,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||||
char definer[USER_HOST_BUFF_SIZE];
|
char definer[USER_HOST_BUFF_SIZE];
|
||||||
enum enum_schema_tables schema_table_idx=
|
enum enum_schema_tables schema_table_idx=
|
||||||
get_schema_table_idx(tables->schema_table);
|
get_schema_table_idx(tables->schema_table);
|
||||||
|
Native_fct_name_collision_error_handler err_handler;
|
||||||
DBUG_ENTER("fill_schema_proc");
|
DBUG_ENTER("fill_schema_proc");
|
||||||
|
|
||||||
strxmov(definer, thd->security_ctx->priv_user, "@",
|
strxmov(definer, thd->security_ctx->priv_user, "@",
|
||||||
|
@ -7254,6 +7276,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
goto err;
|
goto err;
|
||||||
|
thd->push_internal_handler(&err_handler);
|
||||||
|
|
||||||
res= schema_table_idx == SCH_PROCEDURES ?
|
res= schema_table_idx == SCH_PROCEDURES ?
|
||||||
store_schema_proc(thd, table, proc_table, &lookup, full_access,definer) :
|
store_schema_proc(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_proc(thd, table, proc_table, &lookup, full_access, definer) :
|
||||||
store_schema_params(thd, table, proc_table, &lookup, full_access, definer);
|
store_schema_params(thd, table, proc_table, &lookup, full_access, definer);
|
||||||
}
|
}
|
||||||
|
thd->pop_internal_handler();
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (proc_table->file->inited)
|
if (proc_table->file->inited)
|
||||||
|
|
Loading…
Reference in a new issue