diff --git a/sql/field.cc b/sql/field.cc index 2c29dc2e25a..a890ba98539 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -11490,9 +11490,9 @@ void Field::raise_note_cannot_use_key_part(THD *thd, const LEX_CSTRING colv(op_collation->coll_name); push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, - "Cannot use key %`.*s part[%u] for lookup: " - "%`.*s.%`.*s.%`.*s of collation %`.*s " - "%.*s \"%.*T\" of collation %`.*s", + "Cannot use key %.*sQ part[%u] for lookup: " + "%.*sQ.%.*sQ.%.*sQ of collation %.*sQ " + "%.*s \"%.*sT\" of collation %.*sQ", (int) keyname.length, keyname.str, part, (int) table->s->db.length, table->s->db.str, @@ -11514,9 +11514,9 @@ void Field::raise_note_cannot_use_key_part(THD *thd, const LEX_CSTRING dtypev(value->type_handler()->name().lex_cstring()); push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, - "Cannot use key %`.*s part[%u] for lookup: " - "%`.*s.%`.*s.%`.*s of type %`.*s " - "%.*s \"%.*T\" of type %`.*s", + "Cannot use key %.*sQ part[%u] for lookup: " + "%.*sQ.%.*sQ.%.*sQ of type %.*sQ " + "%.*s \"%.*sT\" of type %.*sQ", (int) keyname.length, keyname.str, part, (int) table->s->db.length, table->s->db.str, @@ -11544,8 +11544,8 @@ void Field::raise_note_key_become_unused(THD *thd, const String &expr) const { push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, - "Cannot use key parts with %`.*s.%`.*s.%`.*s " - "in the rewritten condition: %`.*s", + "Cannot use key parts with %.*sQ.%.*sQ.%.*sQ " + "in the rewritten condition: %.*sQ", (int) table->s->db.length, table->s->db.str, (int) table->s->table_name.length, table->s->table_name.str, (int) field_name.length, field_name.str, diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index e3f2c0a11ca..9d2e0b7cffd 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -793,7 +793,7 @@ bool Item_subselect::exec() QT_WITHOUT_INTRODUCERS)); push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_UNKNOWN_ERROR, "DBUG: Item_subselect::exec %.*b", + ER_UNKNOWN_ERROR, "DBUG: Item_subselect::exec %.*sB", print.length(),print.ptr()); ); /* diff --git a/sql/item_vectorfunc.cc b/sql/item_vectorfunc.cc index 98bb3fd68b8..fc038b1f9d2 100644 --- a/sql/item_vectorfunc.cc +++ b/sql/item_vectorfunc.cc @@ -131,9 +131,9 @@ String *Item_func_vec_totext::val_str_ascii(String *str) if (r1->length() % 4) { THD *thd= current_thd; - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_VECTOR_BINARY_FORMAT_INVALID, - ER_THD(thd, ER_VECTOR_BINARY_FORMAT_INVALID)); + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + ER_VECTOR_BINARY_FORMAT_INVALID, + ER_THD(thd, ER_VECTOR_BINARY_FORMAT_INVALID)); null_value= true; return nullptr; } diff --git a/sql/opt_vcol_substitution.cc b/sql/opt_vcol_substitution.cc index 4158844f356..7ad63c21417 100644 --- a/sql/opt_vcol_substitution.cc +++ b/sql/opt_vcol_substitution.cc @@ -287,7 +287,7 @@ void print_vcol_subst_warning(THD *thd, Field *field, Item *expr, ER_UNKNOWN_ERROR, "Cannot substitute virtual column expression %*s -> %*s " "due to %s", - expr_length, expr_buffer.c_ptr_safe(), + (int) expr_length, expr_buffer.c_ptr_safe(), (int) field->field_name.length, field->field_name.str, cause); } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 88a858cf4b6..5764d09e9d8 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -1884,7 +1884,7 @@ bool Sql_cmd_delete::prepare_inner(THD *thd) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, WARN_INDEX_HINTS_IGNORED, - ER_THD(thd, WARN_INDEX_HINTS_IGNORED)); + "%s", ER_THD(thd, WARN_INDEX_HINTS_IGNORED)); } } if (table_list->vers_conditions.is_set() && table_list->is_view_or_derived()) diff --git a/sql/sql_error.h b/sql/sql_error.h index ead860010ad..89ef08610cd 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -1332,7 +1332,8 @@ void push_warning(THD *thd, Sql_condition::enum_warning_level level, uint code, const char *msg); void push_warning_printf(THD *thd, Sql_condition::enum_warning_level level, - uint code, const char *format, ...); + uint code, const char *format, ...) + ATTRIBUTE_FORMAT(printf, 4, 5); bool mysqld_show_warnings(THD *thd, ulong levels_to_show); diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 891f6a6746e..2e4984ba505 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -320,7 +320,7 @@ static inline int open_stat_table_for_ddl(THD *thd, TABLE_LIST *table, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_CHECK_NO_SUCH_TABLE, "Got error %d when trying to open statistics " - "table %`s for updating statistics", + "table %sQ for updating statistics", error_handler.got_error(), stat_table_name->str); } return res; diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 5f608ded594..4ccfc200fff 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -970,7 +970,7 @@ ha_example::check_if_supported_inplace_alter(TABLE* altered_table, if (f_new) { push_warning_printf(ha_thd(), Sql_condition::WARN_LEVEL_NOTE, - ER_UNKNOWN_ERROR, "EXAMPLE DEBUG: Field %`s COMPLEX '%s' -> '%s'", + ER_UNKNOWN_ERROR, "EXAMPLE DEBUG: Field %sQ COMPLEX '%s' -> '%s'", table->s->field[i]->field_name.str, f_old->complex_param_to_parse_it_in_engine, f_new->complex_param_to_parse_it_in_engine); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 97cf6df27d5..0d26b70a779 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -11166,7 +11166,7 @@ create_table_info_t::create_options_are_invalid() } switch (m_create_info->key_block_size) { - ulint kbs_max; + ulong kbs_max; case 1: case 2: case 4: @@ -11183,8 +11183,8 @@ create_table_info_t::create_options_are_invalid() push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE=%ld" - " cannot be larger than %ld.", + "InnoDB: KEY_BLOCK_SIZE=%lu" + " cannot be larger than %lu.", m_create_info->key_block_size, kbs_max); ret = "KEY_BLOCK_SIZE"; @@ -21175,7 +21175,7 @@ dberr_t innodb_decryption_failed(THD *thd, dict_table_t *table) const int dblen= int(table->name.dblen()); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_DECRYPTION_FAILED, - "Table %`.*s.%`s in tablespace " UINT32PF + "Table %.*sQ.%sQ in tablespace " UINT32PF " (file %s) cannot be decrypted.", dblen, table->name.m_name, table->name.m_name + dblen + 1, @@ -21197,7 +21197,7 @@ void innodb_fk_error(const trx_t *trx, dberr_t err, const char *name, (trx, &foreign, false); push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN, convert_error_code_to_mysql(err, 0, nullptr), - "CREATE or ALTER TABLE %`.*s.%`s failed%s%.*s", + "CREATE or ALTER TABLE %.*sQ.%sQ failed%s%.*s", dblen, name, name + dblen + 1, err == DB_DUPLICATE_KEY ? ": duplicate name" : "",