[wp-trac] [WordPress Trac] #42381: Wordpress update does not check if database structure/scheme on existing site is equal to how it would be on a new install

WordPress Trac noreply at wordpress.org
Mon Oct 30 18:19:45 UTC 2017


#42381: Wordpress update does not check if database structure/scheme on existing
site is equal to how it would be on a new install
--------------------------+-----------------------------
 Reporter:  mike_vl       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  4.8.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 '''Description of bug'''
 When trying to add a category I receive the error:

 WordPress database error: [Duplicate entry ‘test’ for key ‘slug’] INSERT
 INTO wp_terms (name, slug, term_group) VALUES (‘Test’, ‘test’, 0)

 '''What seems to be the cause of the problem?'''
 My install does not allow a category (test) with the same slug as an
 existing tag (test). WordPress should allow this.

 On further investigation: in wp_terms table, the field slug has a UNIQUE
 constraint. This was changed in WordPress 4.1
 [https://core.trac.wordpress.org/ticket/22023/ three years ago].

 Duplicates are now prevented in WordPress code instead of in the database,
 but it seems like my site has skipped one or more database core updates.

 '''In short'''
 My install is up to date. But my database core structure/scheme is not up
 to date. wp_repair, wp_optimize etc. do not flag this.

 Also setting WP_ALLOW_REPAIR in wp-config.php does not flag this as an
 issue.

 I was able to fix this but potentially my database still has other
 undetected differences.

 Questions
 - Should WordPress check on update if a existing database structure/scheme
 matches how it should be if it were new install?
 - Should WordPress offer (after backup disclaimer etc.) offer to
 repair/update the database structure to the latest version?

 I submit this as a bug and not as a feature since I feel WP_ALLOW_REPAIR
 should detect if a WordPress table is setup correctly.

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


More information about the wp-trac mailing list