mysql - Duplicate entry for key 'PRIMARY' .Ignoring the spaces for strings -
mysql> Create table primary 2 (boom text, id int, primary key (boom (5))); The query is ok, affected 0 rows (0.04 seconds) mysql & gt; Include primary 2 values ('viok', 1); The query is fine, 1 row affected (0.00 seconds) mysql & gt; Include primary 2 values ('viok', 1); Error 1062 (23000): Key 'primary' mysql & gt; For duplicate entry 'viok' include the primary 2 values ('viok', 1); Error 1062 (23000): Duplicate entry of 'viok' for key 'primary' STRING 'viok' and 'viok' are different. How to add a wire with spaces?
Question: How to add a string with spaces? A: This is not possible. In relation to how MySQL stores these as index entries, the TEXT values 'viok' and 'viok' are not unique. It is: If a text column is indexed, then the comparison of the index entry is end-padded. This means that, if index specific values are required, there will be duplicate-key errors for the value that differs in the number of subsequent spaces. For example, if there is a 'A' in the table, an attempt to store 'A' causes a duplicate-key error. This is not correct for the Blob column.
Comments
Post a Comment