Page MenuHomePhabricator

Postgres installation fails (null value in column "rc_cur_time" violates not-null constraint)
Closed, ResolvedPublic

Description

Author: basil

Description:
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.


Version: 1.23.0
Severity: normal

Details

Reference
bz61318

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:08 AM
bzimport set Reference to bz61318.

basil wrote:

This was found using postgres 9.1.11

basil wrote:

Git bisect found commit 974562aee92a78be82cf8e1416ef44648bb7dbb7 to be the cause of the bug

Created attachment 15127
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.

Attached:

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.

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.