MySQL提示[Warning] Invalid (old?) table or database name问题的解决方法
2022-11-12 09:22:03
内容摘要
这篇文章主要为大家详细介绍了MySQL提示[Warning] Invalid (old?) table or database name问题的解决方法,具有一定的参考价值,可以用来参考一下。
对此感兴趣的朋友,看看idc
文章正文
这篇文章主要为大家详细介绍了MySQL提示[Warning] Invalid (old?) table or database name问题的解决方法,具有一定的参考价值,可以用来参考一下。
对此感兴趣的朋友,看看idc笔记做的技术笔记!
DROP TABLE IF EXISTS [TEMP_TABLE_NAME];create temporary table [TEMP_TABLE_NAME] select col1,col2,... from [TABLE_NAME];alter table [TEMP_TABLE_NAME] add unique idx_col1(col1);经过以上操作中,多次出现该warning问题。通过查询和跟踪调试源码,有以下线索和处理方式:mysql的"[Warning] Invalid (old?) table or database name"问题出现位置:sql_table.cc:279uint explain_filename (THD* thd, const char *from, char *to , uint to_length , enum_explain_filename_mode explain_mode )跟踪代码发现,只有在ha_innodb.cc:1946的innobase_convert_identifier 中调用explain_filename函数。代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <code> /*****************************************************************/ /** Convert an SQL identifier to the MySQL system_charset_info (UTF-8) and quote it if needed. @return pointer to the end of buf */ static char* innobase_convert_identifier ( /*========================*/ char* buf, /*!< out: buffer for converted identifier */ ulint buflen, /*!< in: length of buf, in bytes */ const char * id, /*!< in: identifier to convert */ ulint idlen, /*!< in: length of id, in bytes */ void* thd, /*!< in: MySQL connection thread, or NULL */ ibool file_id) /*!< in: TRUE=id is a table or database name; FALSE=id is an UTF-8 string */ </code> |
代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <code> /*****************************************************************/ /** Convert a table or index name to the MySQL system_charset_info (UTF-8) and quote it if needed. @return pointer to the end of buf */ extern "C" UNIV_INTERN char* innobase_convert_name ( /*==================*/ char* buf, /*!< out: buffer for converted identifier */ ulint buflen, /*!< in: length of buf, in bytes */ const char * id, /*!< in: identifier to convert */ ulint idlen, /*!< in: length of id, in bytes */ void* thd, /*!< in: MySQL connection thread, or NULL */ ibool table_id) /*!< in: TRUE=id is a table or database name; FALSE=id is an index name */ </code> |
代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <code> ha_innodb.cc:6269 调用innodb_convert_identifier函数 /*****************************************************************/ /** Creates a table definition to an InnoDB database. */ static create_table_def ( /*=============*/ trx_t* trx, /*!< in: InnoDB transaction handle */ TABLE* form, /*!< in: information on table columns and indexes */ const char * table_name, /*!< in: table name */ const char * path_of_temp_table, /*!< in: if this is a table explicitly created by the user with the TEMPORARY keyword, then this parameter is the dir path where the table should be placed if we create an .ibd file for it (no .ibd extension in the path, though); otherwise this is NULL */ ulint flags) /*!< in: table flags */ </code> |
代码如下:
1 2 3 4 5 6 7 8 | <code> row0mysql.c:1820 UNIV_INTERN int row_create_table_for_mysql( /*=======================*/ dict_table_t* table, /*!< in, own: table definition (will be freed) */ trx_t* trx) /*!< in: transaction handle */ </code> |
注:关于MySQL提示[Warning] Invalid (old?) table or database name问题的解决方法的内容就先介绍到这里,更多相关文章的可以留意
代码注释