List:General Discussion« Previous MessageNext Message »
From:Gleb Paharenko Date:September 13 2005 2:14pm
Subject:Re: serial primary key produces two indexes
View as plain text  
Hello.

SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
So you really specifying two keys (primary and unique). See:
  http://dev.mysql.com/doc/mysql/en/news-4-1-0.html
	http://bugs.mysql.com/bug.php?id=13140



Kemin Zhou <kzhou@stripped> wrote:
> I recently discovered that the following
> 
> create table ttt (
>    id serial primary key,
>    txt text
> );
> 
> show index from ttt
> 
> is telling me that there is a primary ke on id column with BTREE
> and at the same time, there is another unique index on the id column.
> 
> This is redundant. 
> 
> if the id column had been specified as
> 
> id integer auto_increment primary key,
> then there is only one primary key
> 
> So it looks that there is a bug in the mysql source code.
> Could some exper please confirm my opinion?
> 
> I am using version 4.1
> 
> Kemin
> 
> 
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   Gleb.Paharenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com



Thread
serial primary key produces two indexesKemin Zhou13 Sep
  • Re: serial primary key produces two indexesGleb Paharenko13 Sep
    • Re: serial primary key produces two indexesKemin Zhou14 Sep