Page MenuHomePhabricator

PostgreSQL FK constraint oldimage_oi_name_fkey_cascade needs "ON UPDATE CASCADE"
Closed, ResolvedPublic

Description

Author: fleming

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


Version: 1.16.x
Severity: normal

Attached:

Details

Reference
bz19445

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 Medium.Nov 21 2014, 10:39 PM
bzimport set Reference to bz19445.

Thanks for the report - fixed in r53510

Jdforrester-WMF subscribed.

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