I have just received an SQL insert script, but it fails on a duplicate key entry:
I am trying to insert :
1)Montaña
2)Montana
My tables are all utf8_spanish2_ci,
can anybody explain why this is happening ?
I have just received an SQL insert script, but it fails on a duplicate key entry:
I am trying to insert :
1)Montaña
2)Montana
My tables are all utf8_spanish2_ci,
can anybody explain why this is happening ?
The utf8_spanish2_ci
collation is indeed not only case insensitive, but also partly accent insensitive, so (as Joni Salonen points out, this is incorrect!) but ñ
= n
.á
= a
.
There is, as far as I know, no collation that does not come with this "feature" except utf8_bin
.
What you can do:
This is most likely due to the collation considering Montaña and Montana to be identical.
(The collation determines the result of String comparisions.)
Are you sure that this particular column has the collation utf8_spanish2_ci
?
The words Montana and Montaña are NOT equal according to this collation, as you can verify with this SQL:
mysql> select 'Montana' = 'Montaña' collate utf8_spanish2_ci as eq;
+----+
| eq |
+----+
| 0 |
+----+
Is it possible that somehow the collation is changed to utf8_general_ci? In this collation n and ñ are equal.