[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-internals
Subject:    Re: Reliably identifying primary keys
From:       Martin Skold <Martin.Skold () mysql ! com>
Date:       2008-03-10 11:53:09
Message-ID: 47D52125.2080304 () mysql ! com
[Download RAW message or body]

Hi!

Note that in the current 5.1 implementation of online add/drop
index there are bugs related to adding/dropping unique indexes
that are promoted to primary keys. A fix has been committed for
this for 5.1 and will be pushed soon:
http://lists.mysql.com/commits/43079
In 6.0 the online alter table interface has changed and another fix will
be committed soon.

BR
-- Martin

Timothy P Clark wrote:
> Hi,
>
> The storage engine that I am working on is required to treat primary keys
> differently than other indexes. As well, we would like our SE to be able to
> support online adding/dropping of indexes. The problem is that I'm
> uncertain how to reliably identify whether a key that the storage engine is
> given is actually a primary key. There appear to be two methods for
> determing whether a key is the primary key: using table->s->primary_key,
> and using the name of the key, which appears to always be "PRIMARY" for the
> primary key.
>
> I assumed that the first option (table->s->primary_key) would be the most
> reliable method. However, when a key is added to an existing table, this
> information is not updated before handler::add_index is called.
> Consequently, it seems that I am required to rely on the name of the key (
> == "PRIMARY") to determine whether it is the primary key.
>
> Can I always rely on the name of the key? If not, what can I use in
> add_index to know whether the key should be the primary key?
>
> Thank you,
> Tim Clark
>
>
>   


-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals?unsub=mysql-internals@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic