domjudge
domjudge copied to clipboard
Removing user with submissions fails
Description of the problem
We get the following error: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (
domjudge.
judging_run, CONSTRAINT
FK_29A6E6E13CBA64F2 FOREIGN KEY (
judgetaskid) REFERENCES
judgetask (
judgetaskid))
when deleting a user which has submissions.
Your environment
- main branch
- BAPC2023 dump
Steps to reproduce
- Either load the BAPC2023 dump or upload a contest with example problems
- Make sure everything is judged
- Remove the user which uploaded the problems via GUI
- The screen hangs as we fail in the background
- Remove a team user
- Same result
Expected behaviour
The user gets deleted, no server errors expected
Actual behaviour
Hanging screen, user is not removed.
I would argue that deleting a user should not cascade to deleting the team (which then would cascade to deleting their submission and other data). You can have multiple users per team, so deleting one (even if the last one) should probably not cascade at all.
Now for the (same) error that is visible when deleting a team: it probably requires a fix similar to this one: 181ae06a5625611274f7217be85cfd28d5f351b4