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 2070535 - Content View publish fails with error PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time.
Summary: Content View publish fails with error PG::CardinalityViolation: ERROR: ON CON...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.10.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: 6.12.0
Assignee: Lucy Fu
QA Contact: Jameer Pathan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-31 11:53 UTC by Gourav Padholia
Modified: 2024-02-08 19:10 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2112419 (view as bug list)
Environment:
Last Closed: 2022-11-16 13:33:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34779 0 Normal Ready For Testing Content View publish fails with error PG::CardinalityViolation: ERROR: ON CONFLICT DO UPDATE command cannot affect row a... 2022-07-28 15:39:44 UTC
Red Hat Issue Tracker SAT-9400 0 None None None 2022-09-23 21:01:41 UTC
Red Hat Knowledge Base (Solution) 6960899 0 None None None 2022-05-26 16:44:07 UTC
Red Hat Product Errata RHSA-2022:8506 0 None None None 2022-11-16 13:34:01 UTC

Description Gourav 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:

Comment 2 Pablo Hess 2022-03-31 15:20:00 UTC
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.

Comment 7 Lucy Fu 2022-04-14 18:26:17 UTC
Created redmine issue https://projects.theforeman.org/issues/34779 from this bug

Comment 8 Bryan Kearney 2022-04-14 20:04:57 UTC
Upstream bug assigned to lufu

Comment 9 Bryan Kearney 2022-04-14 20:04:58 UTC
Upstream bug assigned to lufu

Comment 29 Lai 2022-08-15 14:59:22 UTC
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

Comment 34 errata-xmlrpc 2022-11-16 13:33:45 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 (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


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