Actions
Bug #28152
closedPG::ForeignKeyViolation when trying to add a relation to deleted users
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Description
The migration added in https://projects.theforeman.org/issues/21083 / https://github.com/theforeman/foreman-tasks/pull/364 fails when migrating a task that references a (now) not existing user:
[DEBUG 2019-10-30T11:03:33 main] PG::ForeignKeyViolation: ERROR: insert or update on table "foreman_tasks_tasks" violates foreign key constraint "fk_rails_a56904dd86" [DEBUG 2019-10-30T11:03:33 main] DETAIL: Key (user_id)=(10) is not present in table "users". [DEBUG 2019-10-30T11:03:33 main] : UPDATE "foreman_tasks_tasks" SET "user_id" = 10 WHERE "foreman_tasks_tasks"."id" IN (SELECT "foreman_tasks_tasks"."id" FROM "foreman_tasks_tasks" INNER JOIN "foreman_tasks_locks" ON "foreman_tasks_locks"."task_id" = "foreman_tasks_tasks"."id" WHERE "foreman_tasks_tasks"."id" IN (SELECT "foreman_tasks_locks"."task_id" FROM "foreman_tasks_locks" WHERE "foreman_tasks_locks"."name" = $1 AND "foreman_tasks_locks"."resource_id" = $2))
Updated by Evgeni Golov about 5 years ago
- Related to Refactor #21083: Use explicit relation for task -> user association added
Updated by Patrick Thyen about 5 years ago
After running a cleanup with:
"foreman-rake foreman_tasks:cleanup TASK_SEARCH='owner.id = 10' VERBOSE=true"
The Update works fine (assuming, there are no other deleted users, that trigger this problem).
Updated by The Foreman Bot about 5 years ago
- Status changed from New to Ready For Testing
- Assignee set to Adam Ruzicka
- Pull request https://github.com/theforeman/foreman-tasks/pull/470 added
Updated by The Foreman Bot about 5 years ago
- Fixed in Releases foreman-tasks-0.17.1 added
Updated by Anonymous about 5 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 223788a5313594b26ea488a3edccd46128890433.
Updated by Adam Ruzicka about 5 years ago
- Fixed in Releases foreman-tasks-0.16.3 added
Actions