"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:
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;
Without this, the failure leaves the database and file repository in an inconsistent state. I think that this could be fixed by using transactions.