Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.7.0
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
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:
Environment:
Last Closed: 2020-04-14 13:26:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 28152 0 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 0 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:

<pre>
[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))
</pre>

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

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

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.

https://access.redhat.com/errata/RHSA-2020:1454


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