[wp-trac] [WordPress Trac] #34869: dbDelta Index Definition Spaces Duplicate Indexes

WordPress Trac noreply at wordpress.org
Sun Dec 6 17:42:30 UTC 2015


#34869: dbDelta Index Definition Spaces Duplicate Indexes
--------------------------+-----------------------------
 Reporter:  charlestonsw  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  2.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Reference ticket #10404.

 This is to decompose the original ticket into components.  May be fixed in
 4.4.  Needs testing.

 ----


 If the index definition contains spaces dbDelta will create duplicate
 indexes each time it is run.

 No duplicates:
 {{{
 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;");
 }}}

 Duplicates:
 {{{
 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;");
 }}}


 Line of interest, note the space after the comma:

 {{{
  UNIQUE KEY reverse_pkey (term_taxonomy_id, object_id),
 }}}


 Reported by: Denis-de-Bernardy

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34869>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list