[wp-trac] [WordPress Trac] #27062: dbDelta error on plugin activation/deactivation/reactivation

WordPress Trac noreply at wordpress.org
Fri Feb 7 22:15:17 UTC 2014


#27062: dbDelta error on plugin activation/deactivation/reactivation
--------------------------+-----------------------------
 Reporter:  colinhahn     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When a plugin creates a table on activation via dbDelta, dbDelta results
 in an error on a plugin deactivation/reactivation cycle.

 The attached minimalist code demonstrates the problem. The plugin creates
 the table fine, on reactivation the following error results:

 <div id='error'>
                         <p class='wpdberror'><strong>WordPress database
 error:</strong> [Multiple primary key defined]<br />
                         <code>ALTER TABLE testsite_minimalist ADD PRIMARY
 KEY  id (id)</code></p>
                         </div>

 Expected result is no error: dbDelta should not try to define the primary
 key a second time (or should drop the primary key before attempting to
 alter the table).

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


More information about the wp-trac mailing list