sql >> Base de Datos >  >> RDS >> Mysql

MYSQL deshabilita el recorte automático

Según SQL 92 documentación, cuando se comparan dos cadenas, primero se igualan en longitud rellenando la cadena más corta con espacios.

Buscar 8.2 <comparison predicate> en el documento.

If the length in characters of X is not equal to the length
in characters of Y, then the shorter string is effectively
replaced, for the purposes of comparison, with a copy of
itself that has been extended to the length of the longer
string by concatenation on the right of one or more pad char-
acters, where the pad character is chosen based on CS. If
CS has the NO PAD attribute, then the pad character is an
implementation-dependent character different from any char-
acter in the character set of X and Y that collates less
than any string under CS. Otherwise, the pad character is a
<space>.

Así que en otras palabras. No se trata de almacenar el valor con la cantidad de espacios que ingresó, sino de la comparación que hace para verificar si hay una clave principal duplicada. Por lo tanto, no puede tener dos cadenas con una cantidad diferente de espacios que actúen como clave principal