https://bugzilla.wikimedia.org/show_bug.cgi?id=19445

           Summary: PostgreSQL FK constraint oldimage_oi_name_fkey_cascade
                    needs "ON UPDATE CASCADE"
           Product: MediaWiki
           Version: 1.16-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: Database
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=6285)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=6285)
"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.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to