Renamed MySQL table not renamed for INSERT queries?
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 开发者_JAVA技巧to fix this than dumping, dropping, re-creating, and reloading the table?
This is likely to be caused by a trigger that has not been updated accordingly.
If you renamed test_tablename
to tablename
, shouldn't the following be true ?
1146: Table 'dbname.test_tablename' doesn't exist
Be sure to use tablename
in your queries, not test_tablename
.
Are you sure you are not inserting into a view that still references test_tablename
?
精彩评论