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:279

uint 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函数。

/*****************************************************************//**

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 */

顺着线索向上查找,发现在有两个位置调用了innobase_convert_identifier 函数,分两个线索继续查找。

线索一:

ha_innodb.cc:2034

调用innodb_convert_identifier函数

/*****************************************************************//**

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 */

从函数定义和函数功能来看,该函数是将mysql的表名或者索引名转换成utf8,与字符集相关。查看现有数据库字符集和生成的临时表字符集均为lanti1,推断是可能的原因之一。

处理方式:

修改数据库的字符集为utf8,观察数据库是否仍然出现该错误。

线索二:

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 */

在create_table_def 函数中,调用row_create_table_for_mysql函数后,当返回值为DB_DUPLICATE_KEY时,调用innodb_convert_identifier,从而触发该warning。

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 */

该函数中调用了更深层次的函数,但从调试代码来看,暂时没有发现导致该问题的点。

处理方式:

在线索一中的处理方式不能解决问题的情况下,再进行进一步的代码分析。

总结:

经过以上代码调试和分析,得出两条线索,但是一直未能重现该问题。因此,目前只能对现有服务器进行线索一的处理。如果按照线索一处理方式处理后,仍然出现该问题,将对第二步进行深入的分析。

作者 king_wangheng

sqlwarning mysql_mysql提示[Warning] Invalid (old?) table or database name问题的解决方法相关推荐

  1. php warning require,Thinkphp 网站打开提示Warning: require(): open_basedir restriction in effect另一种解决方法...

    Thinkphp网站打开报错如下: Warning: require(): open_basedir restriction in effect. File(/www/wwwroot/123.com/ ...

  2. 计算机安装硬盘后无法启动不了,双硬盘无法启动提示"invalid partition table"开不了机怎么解决?...

    如果硬盘容量不够用的情况下,我们都会在添加一款硬盘,但是安装了双硬盘之后,电脑开不了机并在屏幕上提示" Invalid partition table(无效磁盘分区,硬盘不能启动)" ...

  3. php non numeric,讲解php 出现Warning: A non-numeric value encountered问题的原因及解决方法...

    本文介绍php出现Warning: A non-numeric value encountered问题,用实例分析出现这种错误的原因,并提供避免及解决问题的方法.<?phperror_repor ...

  4. VMware ESXi客户端连接控制台时提示“VMRC控制台连接已断开...正在尝试重新连接“的解决方法

    VMware ESXi客户端连接控制台时提示"VMRC控制台连接已断开...正在尝试重新连接"的解决方法 参考文章: (1)VMware ESXi客户端连接控制台时提示" ...

  5. 【MySQL】MySQL出现Waiting for table metadata lock的原因、解决方法

    Waiting for table metadata lock MySQL在进行alter table等DDL操作时,有时会出现Waiting for table metadata lock的等待场景 ...

  6. 计算机无法连接无线信号,win7系统连接无线信号时提示Windows无法连接到路由器名称的四种解决方法...

    现如今网络发展速度非常快,无线网络已经普及了,使用率高了遇到的问题也就多了.比如有时候笔记本win7系统连接无线信号时出现"Windows无法连接到路由器名称"(如下图所示),该如 ...

  7. 系统提示服务器响应错误,Win10系统无法打开软件提示“服务器没有及时响应或控制请求”错误的解决方法...

    [文章导读]在Win10系统中,有用户在打开软件时遇到了"服务器没有及时响应或控制请求"的错误提示,导致无法打开软件,这该如何解决呢? 在win10系统中,有用户在打开软件时遇到了 ...

  8. Java 提示“找不到或无法加载主类” 解决方法

    Java 提示"找不到或无法加载主类" 解决方法 参考文章: (1)Java 提示"找不到或无法加载主类" 解决方法 (2)https://www.cnblog ...

  9. win7 64位 VS2010调试提示“ORA-12154: TNS: 无法解析指定的连接标识符”的解决方法

    win7 64位 VS2010调试提示"ORA-12154: TNS: 无法解析指定的连接标识符"的解决方法 参考文章: (1)win7 64位 VS2010调试提示"O ...

最新文章

  1. Java集合类学习-LinkedList, ArrayList, Stack, Queue, Vector
  2. ZigZag Conversion leetcode java
  3. struts2之单个文件上传(特别推荐)
  4. Ubuntu修改界面的大小
  5. Windows域控 添加15分钟无操作自动注销域策略【全域策略生效】
  6. C++和JNI的数据转换
  7. Harris角点检测算法手动实现
  8. ASP.NET以编程的方式动态的添加Css引用
  9. android自定义View之自定义可置顶ScrollView,View滑动原理简析
  10. The type XXX is not API (restriction on required library 'D:\jdk-64\jre\lib\rt.jar')
  11. vue读取本机的excel文件的两种方式
  12. QT编程入门系列文章之三十三——国际化(上)
  13. JavaScript在线解压 ZIP 文件 JavaScript 怎样在线解压 ZIP,jszip实现解压压缩包,并下载压缩包内文件
  14. 深度学习模型并非“越大越好”,它可能引起气候变化问题
  15. InnoDB行格式(COMPACT,redundant)对比
  16. swift 函数类型+高阶函数
  17. android imageview方法,Android入门之ImageView的使用方法
  18. Mac软件:分享五款实用的Mac软件,值得收藏
  19. 联想网上审批系统方案
  20. 利用U盘重新安装XP系统

热门文章

  1. 软件测试中需求分析谁去做的,软件项目在进入需求分析阶段,测试人员应该开始介入其中。 - 问答库...
  2. 应用c语言编辑画图程序,应用C语言编辑画图程序
  3. android 自定义表单,Android实现Ant Design 自定义表单组件
  4. linux 取消混杂模式,Linux下网卡混杂模式设置和取消
  5. 2018年工业机器人销量排位_长安-2018年11月汽车销量 细分销量
  6. 简单排序--插入排序
  7. 【chromium】 Chromium OS的oom机制
  8. 系统间账号认证系统同步方案
  9. tf.reduce_mean
  10. MapReduce 详解