Last modified: 2012-09-08 00:06:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26780, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24780 - Cannot delete page due to foreign key constraint on recentchanges
Cannot delete page due to foreign key constraint on recentchanges
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.15.x
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2010-08-13 14:21 UTC by AlbertH
Modified: 2012-09-08 00:06 UTC (History)
5 users (show)

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


Attachments

Description AlbertH 2010-08-13 14:21:26 UTC
Trying to delete a page leads to the following message:

Warning: pg_query() [function.pg-query]: Query failed: ERROR: update or delete on "page" violates foreign key constraint "recentchanges_rc_cur_id_fkey" on "recentchanges" DETAIL: Key (page_id)=(24) is still referenced from table "recentchanges". in /usr/share/mediawiki/includes/db/DatabasePostgres.php on line 580

Warning: pg_query() [function.pg-query]: Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block in /usr/share/mediawiki/includes/db/DatabasePostgres.php on line 580


I indeed have a constraint in the recentchanges table, which probably need to be corrected:

ALTER TABLE mediawiki.recentchanges
  ADD CONSTRAINT recentchanges_rc_cur_id_fkey FOREIGN KEY (rc_cur_id)
      REFERENCES mediawiki.page (page_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION;
Comment 1 AlbertH 2010-08-13 14:32:02 UTC
In the meantime, I found this bug mentioned for Debian:  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517237

The fix suggested there appears to work. I did the following (only changing the ON DELETE action):

ALTER TABLE mediawiki.recentchanges DROP CONSTRAINT recentchanges_rc_cur_id_fkey;

ALTER TABLE mediawiki.recentchanges
  ADD CONSTRAINT recentchanges_rc_cur_id_fkey FOREIGN KEY (rc_cur_id)
      REFERENCES mediawiki.page (page_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE SET NULL;
Comment 2 Marcin Cieślak 2012-03-09 03:56:07 UTC
The constraint was fixed in r15697, so the fix made it into 1.8. 

But it seems there is no update for it. Does anyone still has an old MediaWiki installation that needs to be updated to test?
Comment 3 Karun 2012-09-08 00:06:12 UTC
This has been fixed in r15697.

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


Navigation
Links