Bug 1059946 - SQL error when deleting a sub-component that has sub-components
Summary: SQL error when deleting a sub-component that has sub-components
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Bugzilla
Classification: Community
Component: Administration
Version: 4.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 4.4
Assignee: Simon Green
QA Contact: Matt Tyson 🤬
URL:
Whiteboard:
Depends On: 653316
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-31 03:08 UTC by Jason McDonald
Modified: 2018-12-09 06:29 UTC (History)
3 users (show)

Fixed In Version: 4.4.2014
Clone Of:
Environment:
Last Closed: 2014-03-03 01:00:44 UTC
Embargoed:


Attachments (Terms of Use)

Description Jason McDonald 2014-01-31 03:08:04 UTC
Description of problem:
If attempting to delete a sub-component that has sub-components causes mysql to respond with a foreign key constraint error.

Presumably Bugzilla should either recursively delete the child sub-components first, or only present the Delete link for sub-components that have no children.

Version-Release number of selected component (if applicable):
4.4.1013

How reproducible:
Always

Steps to Reproduce:
1. Go to Administration->Components, choose a Product and click the "Add" link under the Sub-Components heading for a some component.
2. Create a sub-component A and then create a sub-component B with parent A.
3. Click the "Delete" link for sub-component A, and press the confirm button.

Actual results:
DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`bugs/rh_sub_components`, CONSTRAINT `fk_rh_sub_components_parent_id_rh_sub_components_id` FOREIGN KEY (`parent_id`) REFERENCES `rh_sub_components` (`id`) ON UPDATE CASCADE) [for Statement "DELETE FROM rh_sub_components WHERE id = ?"] at Bugzilla/Object.pm line 411

Expected results:
Entire tree below sub-component A is deleted successfully, or I only get the option to delete sub-components that have no children.

Additional info:
none

Comment 1 Simon Green 2014-01-31 03:21:58 UTC
only present the Delete link for sub-components that have no children <-- this.

I thought I had a check for this already,

Comment 4 Matt Tyson 🤬 2014-03-03 01:00:44 UTC
This change is now live. If there are any issues, do not reopen this bug.
Instead, you should create a new bug and reference this bug.


Note You need to log in before you can comment on or make changes to this bug.