Bug 1766948 - PG::ForeignKeyViolation when trying to add a relation to deleted users
Summary: PG::ForeignKeyViolation when trying to add a relation to deleted users
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: 6.7.0
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
Depends On:
TreeView+ depends on / blocked
Reported: 2019-10-30 10:47 UTC by Evgeni Golov
Modified: 2020-04-14 13:26 UTC (History)
3 users (show)

Fixed In Version: tfm-rubygem-foreman-tasks-0.17.1-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-04-14 13:26:24 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Foreman Issue Tracker 28152 High Closed PG::ForeignKeyViolation when trying to add a relation to deleted users 2020-01-20 13:51:27 UTC
Red Hat Product Errata RHSA-2020:1454 None None None 2020-04-14 13:26:33 UTC

Description Evgeni Golov 2019-10-30 10:47:06 UTC
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))

Comment 1 Evgeni Golov 2019-10-30 10:47:10 UTC
Created from redmine issue https://projects.theforeman.org/issues/28152

Comment 2 Evgeni Golov 2019-10-30 10:47:13 UTC
Upstream bug assigned to None

Comment 4 Bryan Kearney 2019-11-06 11:02:28 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 5 Bryan Kearney 2019-11-06 11:02:30 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 6 Bryan Kearney 2019-11-06 15:02:21 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28152 has been resolved.

Comment 7 Peter Ondrejka 2020-01-22 14:55:17 UTC
Verified on sat 6.7 snap 9 by deleting user from 6.6 and upgrading

Comment 10 errata-xmlrpc 2020-04-14 13:26:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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