Mysql
 sql >> Base de données >  >> RDS >> Mysql

MYSQL désactive le découpage automatique

Selon SQL 92 documentation, lorsque deux chaînes sont comparées, elles sont d'abord rendues égales en longueur en remplissant la chaîne la plus courte avec des espaces.

Rechercher 8.2 <comparison predicate> dans le document.

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>.

Donc en d'autres termes. Il ne s'agit pas de stocker la valeur avec le nombre d'espaces que vous avez entré, mais c'est la comparaison qu'il fait pour vérifier la clé primaire en double. Vous ne pouvez donc pas avoir deux chaînes avec un nombre d'espaces différent comme clé primaire