Closed Bug 462877 Opened 16 years ago Closed 16 years ago

Forgetting a saved search that is shared with a group causes a foreign key db error

Categories

(Bugzilla :: Query/Bug List, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dkl, Unassigned)

Details

Attachments

(1 file)

If you have a saved search that you are sharing with another group and you want to delete it, it causes a SQL error when clicking 'Forget' from the userpreferences.cgi screen.

[Mon Nov 03 12:58:51 2008] [error] DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`bugs3/namedquery_group_map`, CONSTRAINT `fk_namedquery_group_map_namedquery_id_namedqueries_id` FOREIGN KEY (`namedquery_id`) REFERENCES `namedqueries` (`id`) ON UPDATE CASCADE) [for Statement "DELETE FROM namedqueries\n                            WHERE id = ?"] at /var/www/html/bugzilla/buglist.cgi line 509

Looking in buglist.cgi, the code is trying to remove the query in namedqueries before it has deleted the row in namedquery_group_map. Reversing the order of SQL statements solves the issue.

Patch attached to fix.

Dave
Attachment #346067 - Flags: review?(LpSolit)
I don't get it. The constraint is supposed to delete parents as well. Why doesn't this work?
Hum ok, the FK constraint is not 3.2, only on tip. But in this case, why does it whine at all?
Actually this is not an upstream bug but a miss configured FK constraint on our end. The original code works in 3.2 since 3.2 does not yet have a FK constraint for the namedquery_group_map table and tip has the proper ON DELETE CASCADE which will remove the extra data automatically. 

I still feel that the patch I have submitted does though order the statements properly and would make since for a database that a) has their FK misconfigured or b) doesn't have a FK configured at all.

Let me know if I should close this bug as NOTABUG or commit the patch.

Dave
Attachment #346067 - Flags: review?(LpSolit)
Yeah, NOTABUG for us, upstream.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: