错误:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '146' for key 'PRIMARY' (SQL: insert into `staff` (`user_id`, `agent_id`, `created_at`) values (363, 2121, 1457079046))
表结构中主键为 id
,自增,146这个条记录确实也存在,插入时,我没有提供id
的值,理论上应该是要自增的,既然自增,理论上不应该存在主键重复的问题。
表结构:
请问什么样的情况会出现这种的问题?
谢谢啦!
天蓬老师2017-04-17 13:56:57
Just looking at the table structure and sql statements, there seems to be no problem. It should be able to be inserted normally
So is it because you used transactions and the previous statement had an impact on this SQL? It’s best to post the code if it’s convenient