Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
DescriptionGourav Padholia
2022-03-31 11:53:48 UTC
Description of problem:
Content View publish fails with error PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time
Version-Release number of selected component (if applicable):
6.10
How reproducible:
Customer Environment
Steps to Reproduce:
1. Create a content view using the below repository
~~~
1) Id: 1
Name: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server
2) Id: 9
Name: Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server
Label: Red_Hat_Enterprise_Linux_7_Server_-_RH_Common_RPMs_x86_64_7Server
3) Id: 7
Name: Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server
Label: Red_Hat_Enterprise_Linux_7_Server_-_Optional_RPMs_x86_64_7Server
4) Id: 6
Name: Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64
Label: Red_Hat_Enterprise_Linux_7_Server_-_Extras_RPMs_x86_64
5) Id: 4
Name: Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server
Label: Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64_7Server
~~~
2. Publish the content view and it will fail with the error "ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time".
Actual results:
Following error while publishing content view
Error:
PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time
HINT: Ensure that no rows proposed for insertion within the same command have duplicate constrained values.
Expected results:
Content view should be published without error.
Additional info:
To anyone looking for a workaround, in my experience working on support tickets this issue is related to the existing CV, where there is a row in foreman DB's katello_repository_references table linking a root_repository_id to a content_view_id by the time the CV publish task tries to add a new row with the exact same root_repository_id and content_view_id.
This all means the issue is particular to the affected Content View. A quick workaround is to create a new Content View that mimics the original one, i.e. contains the same repositories, filters and all, and start using the new Content View instead of the old one, at least until the root cause is figured out and resolved.
Steps to retest:
1. Create a content view using the below repository
~~~
1) Id: 1
Name: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server
2) Id: 9
Name: Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server
Label: Red_Hat_Enterprise_Linux_7_Server_-_RH_Common_RPMs_x86_64_7Server
3) Id: 7
Name: Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server
Label: Red_Hat_Enterprise_Linux_7_Server_-_Optional_RPMs_x86_64_7Server
4) Id: 6
Name: Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64
Label: Red_Hat_Enterprise_Linux_7_Server_-_Extras_RPMs_x86_64
5) Id: 4
Name: Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server
Label: Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64_7Server
~~~
2. Publish the content view
Expected result:
Content view should publish without errors
Actual:
content view does publish without errors
Verified on 6.12 snap 6.1
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 (Important: Satellite 6.12 Release), 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-2022:8506
Description of problem: Content View publish fails with error PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time Version-Release number of selected component (if applicable): 6.10 How reproducible: Customer Environment Steps to Reproduce: 1. Create a content view using the below repository ~~~ 1) Id: 1 Name: Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server 2) Id: 9 Name: Red Hat Enterprise Linux 7 Server - RH Common RPMs x86_64 7Server Label: Red_Hat_Enterprise_Linux_7_Server_-_RH_Common_RPMs_x86_64_7Server 3) Id: 7 Name: Red Hat Enterprise Linux 7 Server - Optional RPMs x86_64 7Server Label: Red_Hat_Enterprise_Linux_7_Server_-_Optional_RPMs_x86_64_7Server 4) Id: 6 Name: Red Hat Enterprise Linux 7 Server - Extras RPMs x86_64 Label: Red_Hat_Enterprise_Linux_7_Server_-_Extras_RPMs_x86_64 5) Id: 4 Name: Red Hat Software Collections RPMs for Red Hat Enterprise Linux 7 Server x86_64 7Server Label: Red_Hat_Software_Collections_RPMs_for_Red_Hat_Enterprise_Linux_7_Server_x86_64_7Server ~~~ 2. Publish the content view and it will fail with the error "ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time". Actual results: Following error while publishing content view Error: PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time HINT: Ensure that no rows proposed for insertion within the same command have duplicate constrained values. Expected results: Content view should be published without error. Additional info: