12/11/2001 17:34:07, Fulko Hew <[EMAIL PROTECTED]> wrote:

>
>I am using mySQL 3.22.4a-beta
>yes, I know its old :-(
>
>I have just stumbled across a problem with how it
>treats 'uniqueness' in table contents.
>
>I have a table with a column defined as:
>
>  create table test (name varchar(80) not null);
>  alter table test ADD UNIQUE (name), ADD INDEX (name);
>
>When I now add entries that are case sensitive, I get duplicate entry errors:
>
>mysql> insert into test (name) values ('a');
>Query OK, 1 row affected (0.04 sec)
>
>mysql> insert into test (name) values ('A');
>ERROR 1062: Duplicate entry 'A' for key 1
>
>
>I always considered the value of 'a' and 'A' to be unique,
>but this version of mySQL doesn't appear to, at least with
>indexes.
>
>Can anyone either point out what I am doing wrong, or a workaround?

The workaround is to use the attribute BINARY for your field
create table test (myfield varchar(80) BINARY not null, UNIQUE KEY myfield);
This way, the index is case sensitive.

Unfortunately, this feature was introduced in MySQL 3.23, so your current server
is not able to deal with it.

Giuseppe

>
>TIA
>Fulko
>
>
>-------------------------------------------------------------------------------
>Fulko Hew,                           Voice:  905-681-5570
>Senior Engineering Designer,         Fax:    905-681-5556
>SITA (Burlington)                    Email:  [EMAIL PROTECTED]
>777 Walkers Line,
>Burlington, Ontario, Canada, L7N 2G1
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to