Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflict in rhnerratacve #70

Closed

Conversation

mbussolotto
Copy link
Member

@mbussolotto mbussolotto commented Jan 8, 2024

Fix for this error:

2023-10-10 18:18:04.951 MDT susemanager susemanager [10169]ERROR:  null value in column "errata_id" of relation "rhnerratacve" violates not-null constraint
2023-10-10 18:18:04.951 MDT susemanager susemanager [10169]DETAIL:  Failing row contains (null, 931, 2023-10-09 17:34:56.101042-06, 2023-10-10 18:16:23.824787-06).
2023-10-10 18:18:04.951 MDT susemanager susemanager [10169]STATEMENT:  INSERT INTO rhnerratacve (errata_id, cve_id, created, modified)  VALUES ((SELECT id FROM rhnerrata WHERE advisory = 'CL-SUSE-15-SP4-2022-3767' AND org_id = (SELECT id FROM web_customer WHERE name = 'SUSE' LIMIT 1) LIMIT 1),(SELECT id FROM rhncve WHERE name = 'CVE-2022-2795' LIMIT 1),'2023-10-09 17:34:56.101042-06:00','2023-10-09 17:34:56.101042-06:00') ON CONFLICT (cve_id, errata_id) DO UPDATE SET errata_id = excluded.errata_id,cve_id = excluded.cve_id,created = excluded.created,modified = excluded.modified;

Last fixes for: https://github.com/SUSE/spacewalk/issues/22785

@mbussolotto mbussolotto changed the title Errata id constraint Fix conflict in rhnerratacve Jan 8, 2024
@mbussolotto mbussolotto requested a review from rjmateus January 8, 2024 16:51
@mbussolotto mbussolotto marked this pull request as ready for review January 8, 2024 16:51
}
}
if errataId == nil {
constraint = "(cve_id) WHERE errata_id IS NULL"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will not work since the table doesn't have a unique constraint with this format. It only has a unique constraint on (errata_id, cve_id)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking it. So do you think if I change rhn_err_cve_cid_idx to unique index might work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can that be unique? Can we say that a CVE ID is only associated to one errata ID? How about CVE's that affect several different packages?
That will not work :)
We need to think about a different solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants