[wp-trac] [WordPress Trac] #34870: dbDelta Not Specifying Key Length Duplicate Indexes

WordPress Trac noreply at wordpress.org
Thu Dec 10 17:40:43 UTC 2015


#34870: dbDelta Not Specifying Key Length Duplicate Indexes
--------------------------+------------------------------
 Reporter:  charlestonsw  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Database      |     Version:  2.8.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+------------------------------

Comment (by mnelson4):

 Regarding @sebet 's comment, I have an update: from my testing, `dbDelta`
 tries to create a duplicate index whenever the index length is changed. Eg
 if you start with
 `KEY movie_type_idx (movie_type(255))` (which, so long as there is no
 space between `movie_type` and `(255)` is actually ok) and then later
 switch it to `KEY movie_type_idx (movie_type(10))` it will try to create a
 duplicate index (although it won't succeed because it will say `Duplicate
 key name 'movie_type'`).
 However, if you go from specifying a length (eg `KEY movie_type_idx
 (movie_type(255))`) to leaving the length UNspecified (eg `KEY
 movie_type_idx (movie_type)`) there is no problem.

 ps: we can't really create unit tests that show this problem because table
 manipulation mysql queries will cause an implicit commit and break the
 unit tests... but having unit tests that show the problem (and show that
 it gets fixed, and doesn't get broken later on) would sure be nice.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34870#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list