Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

While, my query works on almost all entries, it does not work with one particular key.

"INSERT INTO highscores (uuid, name, score) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE score = VALUES(score)"

If I remove the ON DUPLICATE KEY part, both keys throw error that they already exist.

"SELECT * FROM highscores"
a0c0abfe-e859-33d2-8075-a5532417a09d Tomas 408
a0c0abfe-e859-33d2-ffdf-591e2e27509d John 48

Before and after query:

Saving score: a0c0abfe-e859-33d2-8075-a5532417a09d, Tomas, 423
Saved score:  a0c0abfe-e859-33d2-8075-a5532417a09d, Tomas, 408

Saving score: a0c0abfe-e859-33d2-ffdf-591e2e27509d, John, 75
Saved score:  a0c0abfe-e859-33d2-ffdf-591e2e27509d, John, 75

Table layout:

CREATE TABLE highscores (UUID BINARY(16) NOT NULL,
                         NAME VARCHAR(64),
                         SCORE INT,
                         PRIMARY KEY (UUID));

Do you have an idea what could cause this ?

Engine:mysql(5.6.12)

share|improve this question

migrated from serverfault.com Aug 7 '13 at 20:09

This question came from our site for professional system and network administrators.

    
So you are saying the query succeeds but the row doesn't actually change? Is the table MyISAM or InnoDB? –  Michael - sqlbot Aug 8 '13 at 0:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.