Hi Andreas,

On Sat, 2002-02-16 at 08:52, Andreas Frøsting wrote:
> Why does MySQL have this strange behavoir, treating unique indexes
> case-insensitive?
> Can anyone explain MySQL's behaviour and how I do a workaround making
> unique indexes and primary keys case sensitive?
> I've been over the documentation a couple times now unable to find
> anything.

It's a conceptual issue; what you are looking for is not directly
related to indexes. Rather, the case sensitivity of a column (and any
key taken from there) is dependent on the type of that column. If the
type is char, then any operation on that column will by default be
case-insensitive.

This is actually noted in the manual too, when you look at the sections
on CHAR and CREATE TABLE. If you want the column to be case-sensitive,
define the column as BINARY CHAR. In your CREATE/ALTER TABLE statement:
lala VARCHAR(20) BINARY NOT NULL.

That should solve your problem 100% !


Regards,
Arjen.

-- 
Get MySQL Training Worldwide, http://www.mysql.com/training/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Arjen G. Lentz <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Technical Writer, Trainer
/_/  /_/\_, /___/\___\_\___/   Brisbane, QLD Australia
       <___/   www.mysql.com


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