Search code examples
mysqlsqlinsertmysql-error-1146

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 to fix this than dumping, dropping, re-creating, and reloading the table?


Solution

  • This is likely to be caused by a trigger that has not been updated accordingly.