Duplicate Entry Error 1062 for Primary or Unique Keys with Trailing Spaces

(Doc ID 2014601.1)

Last updated on MARCH 08, 2017

Applies to:

MySQL Server - Version 5.1 and later
Information in this document applies to any platform.

Symptoms

 Inserting values which differ only by trailing spaces into a CHAR or VARCHAR field which is defined as a PRIMARY or UNIQUE key results in a duplicate entry error.

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