WordPress.org

Make WordPress Core

Opened 18 months ago

Closed 4 months ago

Last modified 4 months ago

#22134 closed defect (bug) (fixed)

Update Network causes "WordPress database error Table 'wp_signups' already exists for query"

Reported by: tomdxw Owned by: nacin
Milestone: 3.8 Priority: normal
Severity: normal Version: 3.0.1
Component: Database Keywords: has-patch
Focuses: Cc:

Description

The CREATE TABLE statements in wp-admin/includes/schema.php don't use IF NOT EXISTS so they create lots of SQL errors every time you update the network.

Attachments (3)

22134.patch (7.6 KB) - added by faishal 12 months ago.
22134-b.patch (931 bytes) - added by fliespl 12 months ago.
Another solution to fix create table errors (excluding them if exist before triggering create table)
22134.diff (1023 bytes) - added by wonderboymusic 5 months ago.

Download all attachments as: .zip

Change History (22)

comment:1 follow-up: nacin18 months ago

Can you describe the rest of the error? For what query is it failing, what's the backtrace and when exactly does it occur?

These statements do not use IF NOT EXISTS because they go through dbDelta(), which handles various DB upgrades (new indexes, new or changed fields, new tables). These are not SQL statements that are directly and unconditionally run.

comment:2 in reply to: ↑ 1 charlie_hun16 months ago

Replying to nacin:

Can you describe the rest of the error? For what query is it failing, what's the backtrace and when exactly does it occur?

These statements do not use IF NOT EXISTS because they go through dbDelta(), which handles various DB upgrades (new indexes, new or changed fields, new tables). These are not SQL statements that are directly and unconditionally run.

I can confirm this error.

Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_users' already exists a lekérdezésben CREATE TABLE wp_users (
  ID bigint(20) unsigned NOT NULL auto_increment,
  user_login varchar(60) NOT NULL default '',
  user_pass varchar(64) NOT NULL default '',
  user_nicename varchar(50) NOT NULL default '',
  user_email varchar(100) NOT NULL default '',
  user_url varchar(100) NOT NULL default '',
  user_registered datetime NOT NULL default '0000-00-00 00:00:00',
  user_activation_key varchar(60) NOT NULL default '',
  user_status int(11) NOT NULL default '0',
  display_name varchar(250) NOT NULL default '',
  spam tinyint(2) NOT NULL default '0',
  deleted tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (ID),
  KEY user_login_key (user_login),
  KEY user_nicename (user_nicename)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_usermeta' already exists a lekérdezésben
CREATE TABLE wp_usermeta (
  umeta_id bigint(20) unsigned NOT NULL auto_increment,
  user_id bigint(20) unsigned NOT NULL default '0',
  meta_key varchar(255) default NULL,
  meta_value longtext,
  PRIMARY KEY  (umeta_id),
  KEY user_id (user_id),
  KEY meta_key (meta_key)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_blogs' already exists a lekérdezésben
CREATE TABLE wp_blogs (
  blog_id bigint(20) NOT NULL auto_increment,
  site_id bigint(20) NOT NULL default '0',
  domain varchar(200) NOT NULL default '',
  path varchar(100) NOT NULL default '',
  registered datetime NOT NULL default '0000-00-00 00:00:00',
  last_updated datetime NOT NULL default '0000-00-00 00:00:00',
  public tinyint(2) NOT NULL default '1',
  archived enum('0','1') NOT NULL default '0',
  mature tinyint(2) NOT NULL default '0',
  spam tinyint(2) NOT NULL default '0',
  deleted tinyint(2) NOT NULL default '0',
  lang_id int(11) NOT NULL default '0',
  PRIMARY KEY  (blog_id),
  KEY domain (domain(50),path(5)),
  KEY lang_id (lang_id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_blog_versions' already exists a lekérdezésben
CREATE TABLE wp_blog_versions (
  blog_id bigint(20) NOT NULL default '0',
  db_version varchar(20) NOT NULL default '',
  last_updated datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (blog_id),
  KEY db_version (db_version)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_registration_log' already exists a lekérdezésben
CREATE TABLE wp_registration_log (
  ID bigint(20) NOT NULL auto_increment,
  email varchar(255) NOT NULL default '',
  IP varchar(30) NOT NULL default '',
  blog_id bigint(20) NOT NULL default '0',
  date_registered datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (ID),
  KEY IP (IP)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_site' already exists a lekérdezésben
CREATE TABLE wp_site (
  id bigint(20) NOT NULL auto_increment,
  domain varchar(200) NOT NULL default '',
  path varchar(100) NOT NULL default '',
  PRIMARY KEY  (id),
  KEY domain (domain,path)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_sitemeta' already exists a lekérdezésben
CREATE TABLE wp_sitemeta (
  meta_id bigint(20) NOT NULL auto_increment,
  site_id bigint(20) NOT NULL default '0',
  meta_key varchar(255) default NULL,
  meta_value longtext,
  PRIMARY KEY  (meta_id),
  KEY meta_key (meta_key),
  KEY site_id (site_id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:02 blogolj ool www: WordPress adatbázis hiba Table 'wp_signups' already exists a lekérdezésben
CREATE TABLE wp_signups (
  domain varchar(200) NOT NULL default '',
  path varchar(100) NOT NULL default '',
  title longtext NOT NULL,
  user_login varchar(60) NOT NULL default '',
  user_email varchar(100) NOT NULL default '',
  registered datetime NOT NULL default '0000-00-00 00:00:00',
  activated datetime NOT NULL default '0000-00-00 00:00:00',
  active tinyint(1) NOT NULL default '0',
  activation_key varchar(50) NOT NULL default '',
  meta longtext,
  KEY activation_key (activation_key),
  KEY domain (domain)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_users' already exists a lekérdezésben CREATE TABLE wp_users (
  ID bigint(20) unsigned NOT NULL auto_increment,
  user_login varchar(60) NOT NULL default '',
  user_pass varchar(64) NOT NULL default '',
  user_nicename varchar(50) NOT NULL default '',
  user_email varchar(100) NOT NULL default '',
  user_url varchar(100) NOT NULL default '',
  user_registered datetime NOT NULL default '0000-00-00 00:00:00',
  user_activation_key varchar(60) NOT NULL default '',
  user_status int(11) NOT NULL default '0',
  display_name varchar(250) NOT NULL default '',
  spam tinyint(2) NOT NULL default '0',
  deleted tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (ID),
  KEY user_login_key (user_login),
  KEY user_nicename (user_nicename)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_usermeta' already exists a lekérdezésben
CREATE TABLE wp_usermeta (
  umeta_id bigint(20) unsigned NOT NULL auto_increment,
  user_id bigint(20) unsigned NOT NULL default '0',
  meta_key varchar(255) default NULL,
  meta_value longtext,
  PRIMARY KEY  (umeta_id),
  KEY user_id (user_id),
  KEY meta_key (meta_key)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_blogs' already exists a lekérdezésben
CREATE TABLE wp_blogs (
  blog_id bigint(20) NOT NULL auto_increment,
  site_id bigint(20) NOT NULL default '0',
  domain varchar(200) NOT NULL default '',
  path varchar(100) NOT NULL default '',
  registered datetime NOT NULL default '0000-00-00 00:00:00',
  last_updated datetime NOT NULL default '0000-00-00 00:00:00',
  public tinyint(2) NOT NULL default '1',
  archived enum('0','1') NOT NULL default '0',
  mature tinyint(2) NOT NULL default '0',
  spam tinyint(2) NOT NULL default '0',
  deleted tinyint(2) NOT NULL default '0',
  lang_id int(11) NOT NULL default '0',
  PRIMARY KEY  (blog_id),
  KEY domain (domain(50),path(5)),
  KEY lang_id (lang_id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_blog_versions' already exists a lekérdezésben
CREATE TABLE wp_blog_versions (
  blog_id bigint(20) NOT NULL default '0',
  db_version varchar(20) NOT NULL default '',
  last_updated datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (blog_id),
  KEY db_version (db_version)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_registration_log' already exists a lekérdezésben
CREATE TABLE wp_registration_log (
  ID bigint(20) NOT NULL auto_increment,
  email varchar(255) NOT NULL default '',
  IP varchar(30) NOT NULL default '',
  blog_id bigint(20) NOT NULL default '0',
  date_registered datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (ID),
  KEY IP (IP)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_site' already exists a lekérdezésben
CREATE TABLE wp_site (
  id bigint(20) NOT NULL auto_increment,
  domain varchar(200) NOT NULL default '',
  path varchar(100) NOT NULL default '',
  PRIMARY KEY  (id),
  KEY domain (domain,path)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_sitemeta' already exists a lekérdezésben
CREATE TABLE wp_sitemeta (
  meta_id bigint(20) NOT NULL auto_increment,
  site_id bigint(20) NOT NULL default '0',
  meta_key varchar(255) default NULL,
  meta_value longtext,
  PRIMARY KEY  (meta_id),
  KEY meta_key (meta_key),
  KEY site_id (site_id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta
Dec 12 18:52:04 blogolj ool www: WordPress adatbázis hiba Table 'wp_signups' already exists a lekérdezésben
CREATE TABLE wp_signups (
  domain varchar(200) NOT NULL default '',
  path varchar(100) NOT NULL default '',
  title longtext NOT NULL,
  user_login varchar(60) NOT NULL default '',
  user_email varchar(100) NOT NULL default '',
  registered datetime NOT NULL default '0000-00-00 00:00:00',
  activated datetime NOT NULL default '0000-00-00 00:00:00',
  active tinyint(1) NOT NULL default '0',
  activation_key varchar(50) NOT NULL default '',
  meta longtext,
  KEY activation_key (activation_key),
  KEY domain (domain)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci készítette wp_upgrade, make_db_current_silent, dbDelta

comment:3 charlie_hun16 months ago

  • Cc janos@… added

comment:4 jamescollins15 months ago

When upgrading our multisite install from v3.4.2 to v3.5.1, we encountered a lof of these errors too.

The errors occurred when performing the network upgrade (/wp-admin/network/upgrade.php), and they occurred for each and every blog on the install that was upgraded (in our case 37 blogs).

In other words, every time a sub blog's database was upgraded (by hitting /wp-admin/upgrade.php?step=upgrade_db), it generated the following database errors:

WordPress database error Table 'wp_users' already exists for query CREATE TABLE wp_users (\n  ID bigint(20) unsigned NOT NULL auto_increment,\n  user_login varchar(60) NOT NULL default '',\n  user_pass varchar(64) NOT NULL default '',\n  user_nicename varchar(50) NOT NULL default '',\n  user_email varchar(100) NOT NULL default '',\n  user_url varchar(100) NOT NULL default '',\n  user_registered datetime NOT NULL default '0000-00-00 00:00:00',\n  user_activation_key varchar(60) NOT NULL default '',\n  user_status int(11) NOT NULL default '0',\n  display_name varchar(250) NOT NULL default '',\n  spam tinyint(2) NOT NULL default '0',\n  deleted tinyint(2) NOT NULL default '0',\n  PRIMARY KEY  (ID),\n  KEY user_login_key (user_login),\n  KEY user_nicename (user_nicename)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_usermeta' already exists for query \nCREATE TABLE wp_usermeta (\n  umeta_id bigint(20) unsigned NOT NULL auto_increment,\n  user_id bigint(20) unsigned NOT NULL default '0',\n  meta_key varchar(255) default NULL,\n  meta_value longtext,\n  PRIMARY KEY  (umeta_id),\n  KEY user_id (user_id),\n  KEY meta_key (meta_key)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_blogs' already exists for query \nCREATE TABLE wp_blogs (\n  blog_id bigint(20) NOT NULL auto_increment,\n  site_id bigint(20) NOT NULL default '0',\n  domain varchar(200) NOT NULL default '',\n  path varchar(100) NOT NULL default '',\n  registered datetime NOT NULL default '0000-00-00 00:00:00',\n  last_updated datetime NOT NULL default '0000-00-00 00:00:00',\n  public tinyint(2) NOT NULL default '1',\n  archived enum('0','1') NOT NULL default '0',\n  mature tinyint(2) NOT NULL default '0',\n  spam tinyint(2) NOT NULL default '0',\n  deleted tinyint(2) NOT NULL default '0',\n  lang_id int(11) NOT NULL default '0',\n  PRIMARY KEY  (blog_id),\n  KEY domain (domain(50),path(5)),\n  KEY lang_id (lang_id)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_blog_versions' already exists for query \nCREATE TABLE wp_blog_versions (\n  blog_id bigint(20) NOT NULL default '0',\n  db_version varchar(20) NOT NULL default '',\n  last_updated datetime NOT NULL default '0000-00-00 00:00:00',\n  PRIMARY KEY  (blog_id),\n  KEY db_version (db_version)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_registration_log' already exists for query \nCREATE TABLE wp_registration_log (\n  ID bigint(20) NOT NULL auto_increment,\n  email varchar(255) NOT NULL default '',\n  IP varchar(30) NOT NULL default '',\n  blog_id bigint(20) NOT NULL default '0',\n  date_registered datetime NOT NULL default '0000-00-00 00:00:00',\n  PRIMARY KEY  (ID),\n  KEY IP (IP)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_site' already exists for query \nCREATE TABLE wp_site (\n  id bigint(20) NOT NULL auto_increment,\n  domain varchar(200) NOT NULL default '',\n  path varchar(100) NOT NULL default '',\n  PRIMARY KEY  (id),\n  KEY domain (domain,path)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_sitemeta' already exists for query \nCREATE TABLE wp_sitemeta (\n  meta_id bigint(20) NOT NULL auto_increment,\n  site_id bigint(20) NOT NULL default '0',\n  meta_key varchar(255) default NULL,\n  meta_value longtext,\n  PRIMARY KEY  (meta_id),\n  KEY meta_key (meta_key),\n  KEY site_id (site_id)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

WordPress database error Table 'wp_signups' already exists for query \nCREATE TABLE wp_signups (\n  domain varchar(200) NOT NULL default '',\n  path varchar(100) NOT NULL default '',\n  title longtext NOT NULL,\n  user_login varchar(60) NOT NULL default '',\n  user_email varchar(100) NOT NULL default '',\n  registered datetime NOT NULL default '0000-00-00 00:00:00',\n  activated datetime NOT NULL default '0000-00-00 00:00:00',\n  active tinyint(1) NOT NULL default '0',\n  activation_key varchar(50) NOT NULL default '',\n  meta longtext,\n  KEY activation_key (activation_key),\n  KEY domain (domain)\n) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by wp_upgrade, make_db_current_silent, dbDelta

So it looks like each sub-blog database upgrade caused the multisite installation's global tables to be created even though they already existed.

Our multisite install was originally a WPMU install which has been upgraded to multisite in 3.0 and upgraded to each version since then.

For multisite installs that have 1000 of blogs, this would cause (8 x 1000 = 8000) MySQL CREATE TABLE errors.

It seems strange that dbDelta isn't detecting that those global multisite tables already exist.

comment:5 nacin15 months ago

  • Milestone changed from Awaiting Review to 3.6

comment:6 SergeyBiryukov15 months ago

  • Component changed from Network Admin to Database

comment:7 SergeyBiryukov13 months ago

  • Keywords has-patch removed

comment:8 faishal12 months ago

  • Cc faishal added
  • Keywords has-patch added

faishal12 months ago

fliespl12 months ago

Another solution to fix create table errors (excluding them if exist before triggering create table)

comment:9 fliespl12 months ago

#22791 was marked as a duplicate.

comment:10 ryan10 months ago

  • Milestone changed from 3.6 to Future Release

comment:11 conner_bw9 months ago

I'm get this error as well.

[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_users' already exists for query CREATE TABLE wp_users (\n  ID bigint(20) unsigned ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_usermeta' already exists for query \nCREATE TABLE wp_usermeta (\n  umeta_id bigin ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_blogs' already exists for query \nCREATE TABLE wp_blogs (\n  blog_id bigint(20) N ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_blog_versions' already exists for query \nCREATE TABLE wp_blog_versions (\n  blog ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_registration_log' already exists for query \nCREATE TABLE wp_registration_log (\n ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_site' already exists for query \nCREATE TABLE wp_site (\n  id bigint(20) NOT NULL ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_sitemeta' already exists for query \nCREATE TABLE wp_sitemeta (\n  meta_id bigint ... dbDelta
[Mon Jul 15 14:43:43 2013] [error] WordPress database error Table 'wp_signups' already exists for query \nCREATE TABLE wp_signups (\n  domain varchar(2 ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_users' already exists for query CREATE TABLE wp_users (\n  ID bigint(20) unsigned ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_usermeta' already exists for query \nCREATE TABLE wp_usermeta (\n  umeta_id bigin ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_blogs' already exists for query \nCREATE TABLE wp_blogs (\n  blog_id bigint(20) N ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_blog_versions' already exists for query \nCREATE TABLE wp_blog_versions (\n  blog ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_registration_log' already exists for query \nCREATE TABLE wp_registration_log (\n ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_site' already exists for query \nCREATE TABLE wp_site (\n  id bigint(20) NOT NULL ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_sitemeta' already exists for query \nCREATE TABLE wp_sitemeta (\n  meta_id bigint ... dbDelta
[Mon Jul 15 15:07:39 2013] [error] WordPress database error Table 'wp_signups' already exists for query \nCREATE TABLE wp_signups (\n  domain varchar(2 ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_users' already exists for query CREATE TABLE wp_users (\n  ID bigint(20) unsigned ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_usermeta' already exists for query \nCREATE TABLE wp_usermeta (\n  umeta_id bigin ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_blogs' already exists for query \nCREATE TABLE wp_blogs (\n  blog_id bigint(20) N ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_blog_versions' already exists for query \nCREATE TABLE wp_blog_versions (\n  blog ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_registration_log' already exists for query \nCREATE TABLE wp_registration_log (\n ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_site' already exists for query \nCREATE TABLE wp_site (\n  id bigint(20) NOT NULL ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_sitemeta' already exists for query \nCREATE TABLE wp_sitemeta (\n  meta_id bigint ... dbDelta
[Mon Jul 15 15:08:12 2013] [error] WordPress database error Table 'wp_signups' already exists for query \nCREATE TABLE wp_signups (\n  domain varchar(2 ... dbDelta                                                                                                                                                                        

WordPress 3.5.2, Multi Site.

Regards,

comment:12 gradyetc6 months ago

  • Cc mike@… added
  • Version set to 3.0.1

Adding some more background info -- I've been investigating this as we're getting ready to upgrade a MU-era install from 3.1.4 to 3.6.1 and we're encountering the same warnings.

It looks like this has actually been an issue since 3.0.1 due to the logic fliespl describes in #22791. Warnings were triggered during upgrades of non-root blogs as the CREATE TABLE statements for global tables (wp_users and wp_usermeta at the time) hung around due to the continue statement on line 1538 of wp-admin/includes/upgrade.php.

We just didn't notice anything until 3.5 as that's when checks before error_log'ing were removed in WP_DB::print_error().

In 3.3 it got a bit worse due to logic changes in make_db_current* in wp-admin/includes/upgrade.php -- the calls to dbDelta started including the MS global tables at that time.

I'd love to add some unit tests as proof but dbDelta is tricky to test as it's written. I can confirm that 22134-b.patch fixes the issue.

Any chance this could get looked at? We have 1495 sites over 29 networks (and growing) and the unneccessary CREATE statements / warnings are adding 10+ minutes to the upgrade procedure.

comment:13 bananastalktome6 months ago

  • Cc bananastalktome@… added

comment:14 SergeyBiryukov6 months ago

  • Milestone changed from Future Release to 3.8

comment:15 mamun1555 months ago

  • Cc mahmudur@… added

wonderboymusic5 months ago

comment:16 wonderboymusic5 months ago

22134.diff is a refresh and fixes the suppress logic (not forcing false, inheriting instead)

comment:17 nacin4 months ago

We don't actually have to bother with the DESCRIBE as we'll never be creating these tables outside the context of is_main_site().

comment:18 nacin4 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 26566:

In dbDelta(), ensure we are not running CREATE TABLE queries for global tables we wish to not upgrade.

props fliespl.
fixes #22134.

comment:19 charlie_hun4 months ago

  • Cc janos@… removed
Note: See TracTickets for help on using tickets.