I have an AWS RDS MySQL table which has a unique key constraint. Let us take the table name as user
and field name as username
for example. Suppose the table has a row username=admin
. I am executing the below queries using Laravel.
- delete from user where username='admin'
- insert into user (username) values ('admin')
Once in a while, I can see Integrity Constraint Violation1062 Duplicate Entry
in the logs. It seems like the row is not deleted by the time the code executes the insert query. It works most of the time. I can update the code with other logic but wondering why it is happening! Is there any AWS RDS specific scenarios related to this use case? I have not experienced this using own MySQL installation. Thanks for your help!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire