lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: convertion to utf-8
- Date: Sun, 29 Jun 2008 19:07:37 -0500
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- Subject: ***BOGO*** Re: convertion to utf-8
In the last episode (Jun 29), Pooly said:
> Hi,
>
> I'm trying to convert my tables to UTF8 but I'm getting the following error:
> ERROR 1062 (23000): Duplicate entry 'Zorglüb' for key 1
>
> Not too sure why I'm getting this error since the current (latin1) data are:
> mysql> select * from topics_lookup where label like 'Zor%';
> +----------+----------+------+
> | label | topic_id | main |
> +----------+----------+------+
> | Zorglub | 72 | 0 |
> | Zorglüb | 72 | 1 |
> +----------+----------+------+
> 2 rows in set (0.00 sec)
>
> There is a unique index on label, however the 2 data are different.
>
> Any ideas ?
I can't reproduce this. Can you provide example commands demonstrating
your problem?
mysql> create table mytable ( label varchar(200) primary key );
Query OK, 0 rows affected (0.01 sec)
mysql> show create table mytable;
+---------+--------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+--------------------------------------------------------------------------------------------------------------------------+
| mytable | CREATE TABLE `mytable` (
`label` varchar(200) NOT NULL,
PRIMARY KEY (`label`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+---------+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
mysql> insert into mytable values ('Zorglub'), ('Zorglüb');
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> select * from mytable;
+---------+
| label |
+---------+
| Zorglub |
| Zorglüb |
+---------+
2 rows in set (0.00 sec)
mysql> alter table mytable charset=utf8;
Query OK, 2 rows affected (0.02 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> alter table mytable change column label label varchar(200) character set utf8;
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> show create table mytable;
+---------+-----------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+-----------------------------------------------------------------------------------------------------------------------------------+
| mytable | CREATE TABLE `mytable` (
`label` varchar(200) NOT NULL DEFAULT '',
PRIMARY KEY (`label`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
+---------+-----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from mytable;
+---------+
| label |
+---------+
| Zorglub |
| Zorglüb |
+---------+
2 rows in set (0.00 sec)
mysql>
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx