重命名的 MySQL 表没有为 INSERT 查询重命名?
将我的 MySQL 5.1 MyISAM 表之一从 test_tablename
重命名为 tablename
后,我发现如果我尝试执行 INSERT(或 REPLACE)查询,我会收到以下消息:
INSERT INTO tablename (...) VALUES (...)
1146:表“dbname.test_tablename”不存在
我已经三次检查了我的数据库抽象代码,并通过直接在服务器上运行查询来验证这一点。
根据MySQL服务器,CREATE TABLE
语法是tablename
,正如预期的那样,当我运行SHOW TABLES
时,它列出了tablename正如预期的那样。
发生这种情况有什么原因吗?
更重要的是,有没有比转储、删除、重新创建和重新加载表更简单的方法来解决这个问题?
After renaming one of my MySQL 5.1 MyISAM tables from test_tablename
to tablename
, I have found that if I try to execute an INSERT (or REPLACE) query, I get the following message:
INSERT INTO tablename (...) VALUES (...)
1146: Table 'dbname.test_tablename' doesn't exist
I have triple-checked my database abstraction code, and verified this by running the query directly on the server.
According to the MySQL server, the CREATE TABLE
syntax is tablename
, as expected, and when I run SHOW TABLES
, it lists tablename
as expected.
Is there any reason for this to happen?
More importantly, is there an easier way to fix this than dumping, dropping, re-creating, and reloading the table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能是由于未相应更新的触发器造成的。
This is likely to be caused by a trigger that has not been updated accordingly.
如果您将
test_tablename
重命名为tablename
,则以下情况不应该为真吗?请务必在查询中使用
tablename
,而不是test_tablename
。If you renamed
test_tablename
totablename
, shouldn't the following be true ?Be sure to use
tablename
in your queries, nottest_tablename
.您确定没有插入仍然引用
test_tablename
的视图吗?Are you sure you are not inserting into a view that still references
test_tablename
?