Last modified: 2014-04-22 19:38:48 UTC
While trying to install Mediawiki through Postgres the installer constantly failed, throwing the error: Could not insert main page: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script Query: INSERT INTO "recentchanges" (rc_timestamp,rc_namespace,rc_title,rc_type,rc_source,rc_minor,rc_cur_id,rc_user,rc_user_text,rc_comment,rc_this_oldid,rc_last_oldid,rc_bot,rc_ip,rc_patrolled,rc_new,rc_old_len,rc_new_len,rc_deleted,rc_logid,rc_log_type,rc_log_action,rc_params,rc_id) VALUES ('2014-02-13 16:13:55 GMT','0','Main_Page','1','mw.new','0','2','0','MediaWiki default','','2','0','0','10.0.2.2','0','1','0','524','0','0',NULL,'','','2') Function: RecentChange::save Error: 23502 ERROR: null value in column "rc_cur_time" violates not-null constraint even though databases were cleared out.
This was found using postgres 9.1.11
Git bisect found commit 974562aee92a78be82cf8e1416ef44648bb7dbb7 to be the cause of the bug
Created attachment 15127 [details] proposed and tested fix For mysql this column is not null but now defaults to some magic value which means the same as NULL. For PostgreSQL, I'd recommend just dropping the NOT NULL constraint and letting new entries default to null. This patch does that for both new installs and upgrades.
Hi! Thanks for your patch! You are welcome to use Developer access https://www.mediawiki.org/wiki/Developer_access to submit this as a Git branch directly into Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial Putting your branch in Git makes it easier to review it quickly. If you don't want to set up Git/Gerrit, you can also use https://tools.wmflabs.org/gerrit-patch-uploader/ Thanks again! We appreciate your contribution.
Change 127586 had a related patch set uploaded by Jjanes: PostgreSQL: Allow rc_cur_time field to be null. https://gerrit.wikimedia.org/r/127586
Change 128946 had a related patch set uploaded by Jjanes: PostgreSQL: Allow rc_cur_time field to be null. https://gerrit.wikimedia.org/r/128946
Change 128946 merged by jenkins-bot: PostgreSQL: Allow rc_cur_time field to be null. https://gerrit.wikimedia.org/r/128946
Change 127586 merged by jenkins-bot: PostgreSQL: Allow rc_cur_time field to be null. https://gerrit.wikimedia.org/r/127586
Merged into master and backported to 1.23 release.