Skip to content

Commit

Permalink
remove Silence_deprecated_warning
Browse files Browse the repository at this point in the history
it was introduced in ff8651c to suppress deprecated
warnings for CALL under the flawed logic that "It's doesn't
make sense to print out deprecated syntax warnings when the
routine is being executed because this kind of warning only
matters when the routine is being created".

Which is incorrect, a feature might become deprecated after
the routine was created and a user has to know that to be able
to update the procedure before it stops working when a
deprecated feature is removed.
  • Loading branch information
vuvova committed Sep 30, 2023
1 parent 6b9e122 commit 52a0cd3
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions sql/sp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -797,40 +797,6 @@ Sp_handler::db_find_and_cache_routine(THD *thd,
}


/**
Silence DEPRECATED SYNTAX warnings when loading a stored procedure
into the cache.
*/

struct Silence_deprecated_warning : public Internal_error_handler
{
public:
virtual bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
Sql_condition::enum_warning_level *level,
const char* msg,
Sql_condition ** cond_hdl);
};

bool
Silence_deprecated_warning::handle_condition(
THD *,
uint sql_errno,
const char*,
Sql_condition::enum_warning_level *level,
const char*,
Sql_condition ** cond_hdl)
{
*cond_hdl= NULL;
if (sql_errno == ER_WARN_DEPRECATED_SYNTAX &&
*level == Sql_condition::WARN_LEVEL_WARN)
return TRUE;

return FALSE;
}


/**
Make a copy of a SQL statement used for creation of a stored routine.
Expand Down Expand Up @@ -893,7 +859,6 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode,
sql_mode_t old_sql_mode= thd->variables.sql_mode;
ha_rows old_select_limit= thd->variables.select_limit;
sp_rcontext *old_spcont= thd->spcont;
Silence_deprecated_warning warning_handler;
Parser_state parser_state;

thd->variables.sql_mode= sql_mode;
Expand Down Expand Up @@ -927,7 +892,6 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode,
}

thd->lex->sphead= parent;
thd->push_internal_handler(&warning_handler);
thd->spcont= 0;

if (parse_sql(thd, & parser_state, creation_ctx) || thd->lex == NULL)
Expand All @@ -942,7 +906,6 @@ static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode,
sp->set_definition_string(definition_string);
}

thd->pop_internal_handler();
thd->spcont= old_spcont;
thd->variables.sql_mode= old_sql_mode;
thd->variables.select_limit= old_select_limit;
Expand Down

0 comments on commit 52a0cd3

Please sign in to comment.