Page MenuHomePhabricator

Syntax errors in patch-ipb_anon_only.sql called by update.php
Closed, ResolvedPublic

Description

Author: kevin_roberts

Description:
Environment: Windows Server 2003
Web server: Apache 2.2.3
Database: MySQL 5.0.26
Attempting to upgrade 1.7 to 1.8.2

The SQL code in patch-ipb_anon_only.sql which is called by update.php has syntax
errors.

CREATE TABLE code tries to assign default values to TINYBLOB columns, but this
attribute does not apply to TEXT/BLOB columns, and triggers an error (perhaps
because I am running MySQL in strict mode).

The affected columns are:

  1. ipb_address
  2. ipb_reason
  3. ipb_range_start
  4. ipb_range_end
  • CURRENT CODE IS... ***

CREATE TABLE /*$wgDBprefix*/ipblocks_newunique (

ipb_id int(8) NOT NULL auto_increment,
ipb_address tinyblob NOT NULL default '',
ipb_user int(8) unsigned NOT NULL default '0',
ipb_by int(8) unsigned NOT NULL default '0',
ipb_reason tinyblob NOT NULL default '',
ipb_timestamp char(14) binary NOT NULL default '',
ipb_auto bool NOT NULL default 0,
ipb_anon_only bool NOT NULL default 0,
ipb_create_account bool NOT NULL default 1,
ipb_expiry char(14) binary NOT NULL default '',
ipb_range_start tinyblob NOT NULL default '',
ipb_range_end tinyblob NOT NULL default '',

PRIMARY KEY ipb_id (ipb_id),
UNIQUE INDEX ipb_address_unique (ipb_address(255), ipb_user, ipb_auto),
INDEX ipb_user (ipb_user),
INDEX ipb_range (ipb_range_start(8), ipb_range_end(8)),
INDEX ipb_timestamp (ipb_timestamp),
INDEX ipb_expiry (ipb_expiry)

) TYPE=InnoDB;

  • ...BUT SHOULD BE: ***

CREATE TABLE /*$wgDBprefix*/ipblocks_newunique (

ipb_id int(8) NOT NULL auto_increment,
ipb_address tinyblob NOT NULL,
ipb_user int(8) unsigned NOT NULL default '0',
ipb_by int(8) unsigned NOT NULL default '0',
ipb_reason tinyblob NOT NULL,
ipb_timestamp char(14) binary NOT NULL default '',
ipb_auto bool NOT NULL default 0,
ipb_anon_only bool NOT NULL default 0,
ipb_create_account bool NOT NULL default 1,
ipb_expiry char(14) binary NOT NULL default '',
ipb_range_start tinyblob NOT NULL,
ipb_range_end tinyblob NOT NULL,

PRIMARY KEY ipb_id (ipb_id),
UNIQUE INDEX ipb_address_unique (ipb_address(255), ipb_user, ipb_auto),
INDEX ipb_user (ipb_user),
INDEX ipb_range (ipb_range_start(8), ipb_range_end(8)),
INDEX ipb_timestamp (ipb_timestamp),
INDEX ipb_expiry (ipb_expiry)

) TYPE=InnoDB;


Version: 1.8.x
Severity: normal
OS: Windows Server 2003
Platform: PC

Details

Reference
bz7722

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:23 PM
bzimport set Reference to bz7722.
bzimport added a subscriber: Unknown Object (MLST).

kevin_roberts wrote:

MySQL 5.0 manual (http://dev.mysql.com/doc/refman/5.0/en/create-table.html) says:

"...Some attributes do not apply to all data types. AUTO_INCREMENT applies only
to integer types. DEFAULT does not apply to the BLOB or TEXT types."

robchur wrote:

*** This bug has been marked as a duplicate of 7669 ***