Duplicate Entry for Key on Query When Using INSERT ... ON DUPLICATE KEY UPDATE ... (Doc ID 1333888.1)

Last updated on NOVEMBER 23, 2014

Applies to:

MySQL Server - Version: 4.0 and later   [Release: 4.0 and later ]
MySQL Server - Version: 4.0 and later    [Release: 4.0 and later]
Information in this document applies to any platform.

Symptoms

When attempting to use "INSERT INTO ... ON DUPLICATE KEY UPDATE ..." in a replication setup,
the following error can occur on the slave.

Error 'Duplicate entry 'X' for key 'Y' on query. Default database: 'updatetest'. Query: 'INSERT INTO table1 SET col2 = N, col3 = N ON DUPLICATE KEY UPDATE col2 = VALUES(col2), col3 = VALUES(col3)'

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms