SQL:
INSERT INTO hawk_table (player) VALUES (?) ON DUPLICATE KEY UPDATE player=VALUES(player)
Error:
com.mysql.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'usernamePlaceholder' for key 'player'
How to reproduce:
Unknown. If you login as an existing username with another case (Such as changing S to s), then the key will be considered a duplicate and the UPDATE query will be ran. I haven't been able to reproduce this error on MySQL 5.7
I believe this is due to a bug with MySQL. Attempting to update a unique key "ON DUPLICATE KEY" appears to arise issues on some rare occasions with a few users. My guess is it's attempting to replace the prior username with the new username, but since the prior username already exists within the database, it's unable to do so? Could this possibly be a concurrency issue internally?
Error location: https://github.com/bob7l/HawkReloaded/blob/master/src/uk/co/oliwali/HawkEye/database/DataManager.java#L132
SQL: INSERT INTO hawk_table (player) VALUES (?) ON DUPLICATE KEY UPDATE player=VALUES(player)
Error: com.mysql.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'usernamePlaceholder' for key 'player'
How to reproduce: Unknown. If you login as an existing username with another case (Such as changing S to s), then the key will be considered a duplicate and the UPDATE query will be ran. I haven't been able to reproduce this error on MySQL 5.7
I believe this is due to a bug with MySQL. Attempting to update a unique key "ON DUPLICATE KEY" appears to arise issues on some rare occasions with a few users. My guess is it's attempting to replace the prior username with the new username, but since the prior username already exists within the database, it's unable to do so? Could this possibly be a concurrency issue internally?