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

WordPress Trac noreply at wordpress.org
Sat Feb 8 04:51:58 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        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Old description:

> 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).

New description:

 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).

--

Comment (by SergeyBiryukov):

 Related: #10404, #10693.

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


More information about the wp-trac mailing list