Last modified: 2012-08-04 20:49:04 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 T21445, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19445 - PostgreSQL FK constraint oldimage_oi_name_fkey_cascade needs "ON UPDATE CASCADE"
PostgreSQL FK constraint oldimage_oi_name_fkey_cascade needs "ON UPDATE CASCADE"
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.16.x
All All
: Normal normal (vote)
: ---
Assigned To: Greg Sabino Mullane
: patch
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2009-06-30 16:39 UTC by Robert Fleming
Modified: 2012-08-04 20:49 UTC (History)
0 users

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


Attachments
"svn diff" that adds "ON UPDATE CASCADE" (769 bytes, patch)
2009-06-30 16:39 UTC, Robert Fleming
Details

Description Robert Fleming 2009-06-30 16:39:11 UTC
Created attachment 6285 [details]
"svn diff" that adds "ON UPDATE CASCADE"

It seems to me that the foreign-key constraint "oldimage_oi_name_fkey_cascade" on table "oldimage" needs to have "ON UPDATE CASCADE" in addition to "ON DELETE CASCADE".  Without it, "Move" actions on images break when the image to be moved has old revisions.

To fix current installations:

BEGIN;
ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey_cascade;
ALTER TABLE oldimage ADD  CONSTRAINT oldimage_oi_name_fkey_cascade
  FOREIGN KEY (oi_name) REFERENCES image(img_name)
  ON DELETE CASCADE
  ON UPDATE CASCADE;
COMMIT;

Without this, the failure leaves the database and file repository in an inconsistent state.  I think that this could be fixed by using transactions.
Comment 1 Greg Sabino Mullane 2009-07-20 01:56:38 UTC
Thanks for the report - fixed in r53510

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


Navigation
Links