今天开始测试mysql的新版本,从生产mysql库中备份部分表到测试库中。
测试中发现,有些表可以查询出数据,但不能update,报1146,表不存在。
mysql> select version();
+------------+
| version() |
+------------+
| 5.6.12-log |
+------------+
1 row in set
mysql> select bonus from ei_case where case_no='HT102398';
+-------+
| bonus |
+-------+
| 0 |
+-------+
1 row in set
mysql> explain update ei_case set bonus=100 where case_no='HT102398';
+----+-------------+-----------------+-------+---------------+---------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------+-------+---------------+---------+---------+------+--------+-------------+
| 1 | SIMPLE | ei_case | index | NULL | PRIMARY | 4 | NULL | 220156 | Using where |
+----+-------------+-----------------+-------+---------------+---------+---------+------+--------+-------------+
1 row in set
mysql> update ei_case set bonus=100 where case_no='HT102398';
1146 - Table 'test.ei_case_initial' doesn't exist
经查发现要更新的这个表上有个TRIGGER,在update后会向另一张表中插入数据。
而这个表没有从生产复制过来,所以报错。