问题
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