Project

General

Profile

Actions

Bug #3194

closed

Ugly errors when destroy actions are stopped by FKs

Added by Dominic Cleal over 10 years ago. Updated almost 10 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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 issues 4 (0 open4 closed)

Related to Foreman - Feature #2400: Add foreign keys on database levelClosedJoseph Magen04/15/2013Actions
Related to Hammer CLI - Bug #4033: Need a clearer / user friendly message when deletion of smart proxy failsDuplicate01/16/2014Actions
Related to Foreman - Bug #4415: FK error when deleting a smart proxyDuplicate02/23/2014Actions
Is duplicate of Foreman - Bug #5788: before_destroy missing from EnsureNotUsedBy.new in SmartProxy modelClosedJoseph Magen05/19/2014Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Related to Feature #2400: Add foreign keys on database level added
Actions #2

Updated by Dominic Cleal over 10 years ago

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
Actions #3

Updated by Dominic Cleal over 10 years ago

  • Related to Bug #4033: Need a clearer / user friendly message when deletion of smart proxy fails added
Actions #4

Updated by Dominic Cleal about 10 years ago

  • Related to Bug #4415: FK error when deleting a smart proxy added
Actions #5

Updated by Dominic Cleal almost 10 years ago

  • Is duplicate of Bug #5788: before_destroy missing from EnsureNotUsedBy.new in SmartProxy model added
Actions #6

Updated by Dominic Cleal almost 10 years ago

  • 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.

Actions #7

Updated by Dominic Cleal almost 10 years ago

  • Bugzilla link set to https://bugzilla.redhat.com/show_bug.cgi?id=1109315
Actions #8

Updated by Dominic Cleal almost 10 years ago

  • Bugzilla link deleted (https://bugzilla.redhat.com/show_bug.cgi?id=1109315)
Actions

Also available in: Atom PDF