[wp-trac] Re: [WordPress Trac] #2695: dbdelta duplicates indices instead of overwriting them.

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 9 03:10:35 GMT 2006


#2695: dbdelta duplicates indices instead of overwriting them.
---------------------------------------+------------------------------------
 Reporter:  majelbstoat                |        Owner:  ryan   
     Type:  defect                     |       Status:  closed 
 Priority:  normal                     |    Milestone:  2.1    
Component:  Administration             |      Version:  2.1    
 Severity:  normal                     |   Resolution:  invalid
 Keywords:  dbdelta duplicate indices  |  
---------------------------------------+------------------------------------
Changes (by majelbstoat):

  * resolution:  => invalid
  * keywords:  dbdelta duplicate indices bg|commit => dbdelta duplicate
               indices
  * status:  reopened => closed

Comment:

 In fact, it looks like this is a non-issue.  After looking through the
 dbdelta code, I found that the function does check for existing indices
 but is just quite picky about what it matches against.

 Basically, instead of using INDEX, you have to use KEY.  You also have to
 give a name to any indexes you create.  You also need to specify KEY when
 creating a UNIQUE constraint.

 So, changing my definitions from:


 {{{
 UNIQUE (code)
 INDEX language_idx (language_id)
 }}}


 to:

 {{{

 UNIQUE KEY code (code)
 KEY language_idx (language_id)
 }}}


 fixed the problem for me.  Closing as invalid - plugin authors (myself
 included) should just be very precise in their table definitions.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2695>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list