I asked because on my server, the matching key_id has an empty
'provider_id' field

rhnschema=# insert into rhnPackageKey (id, key_id, key_type_id,
provider_id) values
rhnschema-# (sequence_nextval('rhn_pkey_id_seq'), '05b555b38483c65d',
lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
ERROR:  duplicate key value violates unique constraint "rhn_pkey_keyid_uq"
DETAIL:  Key (key_id)=(05b555b38483c65d) already exists.

rhnschema=# select * from rhnPackageKey where key_id='05b555b38483c65d';
 id  |      key_id      | key_type_id | provider_id |            created
         |           modified
-----+------------------+-------------+-------------+-------------------------------+-------------------------------
 157 | 05b555b38483c65d |         100 |             | 2020-02-21
09:06:55.782751-05 | 2020-02-21 09:06:55.782751-05
(1 row)

Actually, there are 3 rows (out of 160) with a NULL provider_id.

156 | 49fc0fd89bd837ba |         100 |             | 2020-02-19
02:06:37.884325-05 | 2020-02-19 02:06:37.884325-05
157 | 05b555b38483c65d |         100 |             | 2020-02-21
09:06:55.782751-05 | 2020-02-21 09:06:55.782751-05
158 | 21ea45ab2f86d6a1 |         100 |             | 2020-02-21
10:53:24.558639-05 | 2020-02-21 10:53:24.558639-05

Wondering if it would be wiser to remove the record

delete from  rhnPackageKey  where key_id='05b555b38483c65d';

Then re-insert it with the same id (157 in my case):

insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
(157, '05b555b38483c65d', lookup_package_key_type('gpg'),
lookup_package_provider('CentOS'));




On Thu, Mar 19, 2020 at 8:14 AM Ree, Jan-Albert van <[email protected]>
wrote:

> ​I skipped nothing but executed all queries, continuing on errors with the
> next one and assumed that if there was an existing record it would be fine
> already...
>
> Maybe not the best way, but it worked.
>
> --
>
> Jan-Albert
>
>
>
> Jan-Albert van Ree | HPC Specialist | Digital Services
> MARIN | T +31 317 49 35 48 | [email protected] | www.marin.nl
>
> [image: LinkedIn] <https://www.linkedin.com/company/marin> [image:
> YouTube] <http://www.youtube.com/marinmultimedia> [image: Twitter]
> <https://twitter.com/MARIN_nieuws> [image: Facebook]
> <https://www.facebook.com/marin.wageningen>
> MARIN news: Courses Hydrodynamics  Floating Offshore Structures & Ship
> design
> <https://www.marin.nl/courses-hydrodynamics-floating-offshore-structures-and-ship-design>
>
> ------------------------------
> *From:* [email protected] <
> [email protected]> on behalf of Eckert, Doug <
> [email protected]>
> *Sent:* Thursday, March 19, 2020 13:08
> *To:* [email protected]
> *Subject:* Re: [Spacewalk-list] Spacewalk 2.10 Released!
>
> Did you skip the one with the duplicate key constraint error, or did you
> remove the existing record with the matching key and re-insert?
>
> _______________________________________________
> Spacewalk-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/spacewalk-list



-- 
Doug Eckert
LEAD ENGINEER, COMPUTE
[image: NewsTech] <http://www.newscorp.com/>
M: +1.732.666.3681 <+1+555+555+5555>    O: +1.609.520.4993 <+1+555+555+5555>
E: [email protected] <[email protected]>
A: PO Box 300, Princeton, NJ 08543
_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to