MDEV-36638 Some optimizer hint warnings are returned as errors

With strict SQL_MODE warnings generated during DDL statements
are threated as errors. This is done to prevent potential data
corruption. However, optimizer hints cannot affect the integrity
of data, so warnings during their parsing or application should not
be escalated to the level of errors.

This commit introduces `push_warning_safe()` method that guarantees
that a warning is not treated as an error, and generation of warnings
during hints processing now uses this method instead of traditional
`push_warning_printf()`
This commit is contained in:
Oleg Smirnov
2025-04-22 21:47:12 +07:00
parent 6cd27dbc43
commit 6e2a0501b6
5 changed files with 142 additions and 22 deletions

View File

@ -1335,6 +1335,10 @@ void push_warning_printf(THD *thd, Sql_condition::enum_warning_level level,
uint code, const char *format, ...)
ATTRIBUTE_FORMAT(printf, 4, 5);
void push_warning_printf_va_list(THD *thd,
Sql_condition::enum_warning_level level,
uint code, const char *format, va_list args);
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
size_t convert_error_message(char *to, size_t to_length,