Last modified: 2010-05-15 15:42:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 7685 - Delete Pages does not work - database error
Delete Pages does not work - database error
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
PC Windows Server 2003
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-10-24 21:18 UTC by Jeffrey Golas
Modified: 2010-05-15 15:42 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Jeffrey Golas 2006-10-24 21:18:11 UTC
Running MediaWiki 1.8.2, PHP 5.1.6, MySql 5.0.2 and IIS 6 on Windows Server
2003. Client is running Firefox on Windows XP Sp2. Whenever I try to
delete a page in MediaWiki, I get the following database error:

database query syntax error has occurred. This may indicate a bug in the
software. The last attempted database query was:

    INSERT INTO `archive`
FROM `page`,`revision` WHERE page_id = '1516' AND (page_id = rev_page) 

from within function "Article::doDeleteArticle". MySQL returned error "1364:
Field 'ar_text' doesn't have a default value (localhost)".

When I installed MediaWiki, I had a problem generating the tables and found a
fix online that discussed changing many "not null default ''" lines to just "not
null". Anyway because of that it seems ar_text is current'y set to just "not
null" with no default value, and Mysql can't create a new row because of that.
When I try to assign a default value to ar_text (or even ar_flags) using either
MySql Query Browser or phpMyAdmin, I get "ar_text cannot have a default value".
I found a posting describing getting around this using phpMyAdmin but I couldn't
replicate it.

It seems the problem is either a MySQL bug (saw some mention of it), or
MediaWiki needs to write something to ar_text even if it isn't used. I did try
changing ar_text and then ar_flags to support null and that seemed to fix the
problem, although I'm not sure if it affects anything else (not a database
expert by any means). From what I researched ar_text is a legacy field that
still exists for backward compatibility or migration purposes.
Comment 1 Brion Vibber 2006-10-25 12:37:44 UTC
Hmm, you should correct the table on your installation to match the definition, or behavior may be incorrect.

If you really do have MySQL 5.0.2, be aware this is a very old alpha release. Upgrade to a current 5.0.x if possible.
Comment 2 Jeffrey Golas 2006-10-25 13:30:47 UTC
I'm sorry its 5.0.26, not 5.0.2.
Comment 3 Brion Vibber 2006-10-25 13:53:39 UTC
The standard table definition appears to work fine with MySQL 5.0.26 (tested on Mac OS X).

Can you try dropping the table and recreating it from the definition in tables.sql?
Comment 4 Jeffrey Golas 2006-10-25 15:21:54 UTC
Ok I wiped the database & database user from Mysql. I deleted localsettings.php
from the wiki root folder and from the config folder. I undid all changes I made
to the install scripts that I saw on <a
href="">this posting</a> by
copying the original files overtop them.

I re-ran the install under http://webserver/wiki/config and first tried the
standard "backwards compatible" definition - it errored out with "user_password
can't have a default value".

I then wiped the database, database user, and localsettings file again and tried
it again using the "Experimental Mysql 4/5" definitions. Same problem -
user_password can't have a default value.


Creating tables... using MySQL 5 table defs...Query "CREATE TABLE `user` (
user_id int(5) unsigned NOT NULL auto_increment, user_name varchar(255) binary
NOT NULL default '', user_real_name varchar(255) binary NOT NULL default '',
user_password tinyblob NOT NULL default '', user_newpassword tinyblob NOT NULL
default '', user_email tinytext NOT NULL default '', user_options blob NOT NULL
default '', user_touched char(14) binary NOT NULL default '', user_token
char(32) binary NOT NULL default '', user_email_authenticated CHAR(14) BINARY,
user_email_token CHAR(32) BINARY, user_email_token_expires CHAR(14) BINARY,
user_registration CHAR(14) BINARY, PRIMARY KEY user_id (user_id), UNIQUE INDEX
user_name (user_name), INDEX (user_email_token) ) TYPE=InnoDB, DEFAULT
CHARSET=utf8 " failed with error code "BLOB/TEXT column 'user_password' can't
have a default value (localhost)".

Comment 5 Jeffrey Golas 2006-10-25 15:33:33 UTC
Just to see if it's PHP related - I opened the tables.sql script up in MySql
Query Browser, first created the database manually (create database wikidb) and
then ran the tables.sql script - comes up with the following results:

Script line: 64	BLOB/TEXT column 'user_password' can't have a default value
Script line: 175	BLOB/TEXT column 'page_restrictions' can't have a default value
Script line: 235	BLOB/TEXT column 'rev_comment' can't have a default value
Script line: 287	BLOB/TEXT column 'old_text' can't have a default value
Script line: 320	BLOB/TEXT column 'ar_text' can't have a default value
Script line: 468	BLOB/TEXT column 'el_to' can't have a default value
Script line: 563	BLOB/TEXT column 'ipb_reason' can't have a default value
Script line: 619	BLOB/TEXT column 'img_description' can't have a default value
Script line: 677	BLOB/TEXT column 'oi_description' can't have a default value
Script line: 703	BLOB/TEXT column 'fa_description' can't have a default value
Script line: 870	BLOB/TEXT column 'si_text' can't have a default value
Script line: 949	BLOB/TEXT column 'log_params' can't have a default value
Script line: 991	BLOB/TEXT column 'job_params' can't have a default value
Comment 6 Jeffrey Golas 2006-10-25 16:51:56 UTC
Installed Mysql 4.1.21 on another compuer (under Windows 2000 Pro) and it worked
perfectly...must be something with the Mysql 5 table definitions or Mysql 5.0.26
itself under Windows.
Comment 7 Brion Vibber 2006-10-27 07:48:05 UTC
Did you enable a non-default option in MySQL 5's configuration, such as strict mode?
Comment 8 Jeffrey Golas 2006-10-27 13:36:55 UTC
Actually it *was* in strict mode...which was default for Mysql (turned on). If
strict mode is nothing more than SQL making the app adhere to SQL
should work with it on.

I was able to turn it off and the errors went away.
Comment 9 Brion Vibber 2006-10-27 13:43:46 UTC
Strict mode is definitely not the default; you have to manually add it to my.cnf.
Are you running on Windows? Perhaps you chose this mode during the installation?

Anyway, page deletion still seems to work fine when I enable strict mode with 5.0.26.
Can you provide your my.cnf?
Comment 10 Jeffrey Golas 2006-10-27 13:48:07 UTC
Yes I'm on Windows...when doing the Mysql instance config in Windows, the
"strict mode" checkbox is definitely turned on by default. As a first time Mysql
user I left it like that.

I could send you the my.cnf file later today but its basically all defaults - I
didn't modify it at all.

Comment 11 Brion Vibber 2006-10-27 14:53:29 UTC
Since your defaults appear to include an override from the Windows installer that's *not* in
the default behavior of MySQL as left in its default configuration, and I don't have any
Windows machines available at present, I'll need to know your configuration to do any further
Comment 12 Bryan C Edwards 2006-11-21 18:11:24 UTC
I've experienced this same problem (MySQL windows 5.0.27), which is indeed
installed with strict mode on by default.  I think the real question should be
why does "Article::doDeleteArticle" need a default value for the field "ar_text".
Comment 13 Brion Vibber 2006-12-21 21:45:38 UTC
Fixed in r18480. Query now supplies the redundant default values.
(Would be cleaner still to drop the NOT NULL from the columns and just use NULL
but that would require a db change on existing tables.)

Note You need to log in before you can comment on or make changes to this bug.