Error Code: 1146. but Table does exist

走远了吗. 提交于 2019-12-11 13:36:20

问题


Using MySql 5.5.20 on OSX 10.8.3

I'm restoring a mysql dump from another server using the same major version (5.5) There are a bunch of table CREATE and INSERT statements, then towards the end there are some Triggers defined.

When executing the line:

/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ 
/*!50003 `TRIGGER delete_po_items AFTER DELETE ON CRM_PURCHASEORDER   
FOR EACH ROW BEGIN  DELETE FROM CRM_PO_ITEM 
 where CRM_PO_ITEM.PURCHASEORDER_ID = OLD.PURCHASEORDER_ID; END */

I get the error:

Error Code: 1146. Table 'crm.CRM_PURCHASEORDER' doesn't exist`

But the table CRM_PURCHASEORDER does exist.. It even has around 2000 rows of data.

Due to IP issues I cannot post the original dump, and I haven't had any luck reproducing a minimal test case.

Any hint what could cause this? I saw some other similar postings on SO, but haven't had luck finding a solution that works for me.


回答1:


This issue is all about case-sensitivity of table and column names in MySql, - most notably the variable lower_case_table_names which can be set for a MySql server instance with three possible values!




回答2:


Our team had a near melt down with this problem. It ended up copy/pasting queries out of whats app was causing the issue. It worked correctly when we retyped the query in but sharing queries over a messenger app was causing undetermined behavior.



来源:https://stackoverflow.com/questions/15869476/error-code-1146-but-table-does-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!