[wp-trac] [WordPress Trac] #10404: dbDelta creates duplicate indexes when index definition contains spaces

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 14 10:59:55 UTC 2009


#10404: dbDelta creates duplicate indexes when index definition contains spaces
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:       
     Type:  defect (bug)       |      Status:  new  
 Priority:  normal             |   Milestone:  2.9  
Component:  General            |     Version:  2.8.1
 Severity:  normal             |    Keywords:       
-------------------------------+--------------------------------------------
 I was adding a much needed index in wp_object_term_relationships, and
 testing revealed it was getting added multiple times.

 This works as intended:

 {{{
 CREATE TABLE $wpdb->term_relationships (
  object_id bigint(20) unsigned NOT NULL default 0,
  term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
  term_order int(11) NOT NULL default 0,
  PRIMARY KEY  (object_id,term_taxonomy_id),
  UNIQUE KEY reverse_pkey (term_taxonomy_id,object_id),
  KEY term_taxonomy_id (term_taxonomy_id)
 ) $charset_collate;");
 }}}


 This doesn't:

 {{{
 CREATE TABLE $wpdb->term_relationships (
  object_id bigint(20) unsigned NOT NULL default 0,
  term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
  term_order int(11) NOT NULL default 0,
  PRIMARY KEY  (object_id,term_taxonomy_id),
  UNIQUE KEY reverse_pkey (term_taxonomy_id, object_id),
  KEY term_taxonomy_id (term_taxonomy_id)
 ) $charset_collate;");
 }}}

 the only difference between the two is a space in the reverse_pkey column
 list. we should remove spaces in there to avoid potential bugs.

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


More information about the wp-trac mailing list