Bug #3194
closed
Ugly errors when destroy actions are stopped by FKs
Added by Dominic Cleal over 11 years ago.
Updated over 10 years ago.
Description
Server errors aren't very helpful when an FK prevents a destroy:
PG::ForeignKeyViolation: ERROR: update or delete on table "smart_proxies" violates foreign key constraint "subnets_dhcp_id_fk" on table "subnets"
DETAIL: Key (id)=(1) is still referenced from table "subnets".
: DELETE FROM "smart_proxies" WHERE "smart_proxies"."id" = $1
(145.2ms) ROLLBACK
Completed 500 Internal Server Error in 3385ms
- Related to Feature #2400: Add foreign keys on database level added
And equally ugly in MySQL..
Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (`puppet`.`hostgroups`, CONSTRAINT `hostgroups_puppet_ca_proxy_id_fk` FOREIGN KEY (`puppet_ca_proxy_id`) REFERENCES `smart_proxies` (`id`)): DELETE FROM `smart_proxies` WHERE `smart_proxies`.`id` = 4
- Related to Bug #4033: Need a clearer / user friendly message when deletion of smart proxy fails added
- Related to Bug #4415: FK error when deleting a smart proxy added
- Is duplicate of Bug #5788: before_destroy missing from EnsureNotUsedBy.new in SmartProxy model added
- Status changed from New to Duplicate
We had a helper whose job it was to provide friendly messages, but it wasn't invoked correctly. #5788 has fixed this.
- Bugzilla link set to https://bugzilla.redhat.com/show_bug.cgi?id=1109315
- Bugzilla link deleted (
https://bugzilla.redhat.com/show_bug.cgi?id=1109315)
Also available in: Atom
PDF