Mysql & quot; [Warning] Invalid (old ?) Table or database n

Source: Internet
Author: User
Tags table definition


Mysql "[Warning] Invalid (old ?) Table or database name "error online server [Warning] Invalid (old ?) The table or database name problem is found in the following SQL statements by analyzing the binlog. It is expressed in SQL syntax due to sensitive content. 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); this warning problem occurs multiple times in the preceding operations. Through querying and tracking the debugging source code, there are the following clues and processing methods: "[Warning] Invalid (old?) of www.2cto.com mysql ?) Table or database name "problem location: SQL _table.cc: 279 uint explain_filename (THD * thd, const char * from, char * to, uint to_length, enum_explain_filename_mode explain_mode) tracking code discovery, the explain_filename function is called only in innobase_convert_identifier of ha_innodb.cc: 1946. /*************************************** * *********************** // * 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 */look up along the clues, it is found that innobase_convert_identifier function is called in two locations, two clues are used to continue searching. Www.2cto.com clue 1: ha_innodb.cc: 2034 call the innodb_convert_identifier function /*********************************** * *************************** // ** 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 */for Function Definition and function functions, this function converts the mysql table name or index name to utf8, which is related to the character set. Check that both the existing database character set and the generated temporary table character set are lanti1. inference is one of the possible reasons. Processing Method: Modify the character set of the database to utf8, and check whether the database still has this error. Www.2cto.com lead 2: ha_innodb.cc: 6269 call the innodb_convert_identifier function /*********************************** * ***************************** // Creates a table definition to 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 shocould be placed if we create. ibd file for it (no. ibd extension in the path, though); otherwise this is NULL */ulint flags )/*! <In: table flags */in the create_table_def function, call the row_create_table_for_mysql function and call innodb_convert_identifier when the returned value is DB_DUPLICATE_KEY. Row0mysql. c: 1820UNIV_INTERN int row_create_table_for_mysql (/* ===============================*/dict_table_t * table ,/*! <In, own: table definition (will be freed) */trx_t * trx )/*! <In: transaction handle */www.2cto.com this function calls a deeper function, but from the debugging code, no points are found that cause this problem. Processing Method: Further code analysis is performed when the processing method in Clue 1 cannot solve the problem. Conclusion: After debugging and Analysis of the above Code, two clues are obtained, but the problem has not been reproduced. Therefore, currently, only thread 1 can be processed on existing servers. If the problem still persists after processing according to clue 1, the second step will be analyzed in depth. Author king_wangheng

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.