FYI - I also had the same issue with the last key insert. Did the same for it, using the ' lookup_package_provider' as specified in the insert command
rhnschema=# insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values rhnschema-# (sequence_nextval('rhn_pkey_id_seq'), '21ea45ab2f86d6a1', lookup_package_key_type('gpg'), lookup_package_provider('EPEL')); ERROR: duplicate key value violates unique constraint "rhn_pkey_keyid_uq" DETAIL: Key (key_id)=(21ea45ab2f86d6a1) already exists. rhnschema=# update rhnPackageKey set provider_id=lookup_package_provider('EPEL') where key_id='21ea45ab2f86d6a1'; UPDATE 1 rhnschema=# select * from rhnPackageKey where key_id='21ea45ab2f86d6a1'; id | key_id | key_type_id | provider_id | created | modified -----+------------------+-------------+-------------+-------------------------------+------------------------------- 158 | 21ea45ab2f86d6a1 | 100 | 107 | 2020-02-21 10:53:24.558639-05 | 2020-03-19 08:30:05.672277-04 (1 row) On Thu, Mar 19, 2020 at 8:28 AM Eckert, Doug <doug.eck...@dowjones.com> wrote: > I tried, but it wouldn't let me remove the record due to foreign key > reference, so I updated the existing record instead with the value it > would've used from the 'insert' command: > > rhnschema=# update rhnPackageKey set > provider_id=lookup_package_provider('CentOS') where > key_id='05b555b38483c65d'; > UPDATE 1 > rhnschema=# select * from rhnPackageKey where key_id='05b555b38483c65d'; > id | key_id | key_type_id | provider_id | created > | modified > > -----+------------------+-------------+-------------+-------------------------------+------------------------------- > 157 | 05b555b38483c65d | 100 | 102 | 2020-02-21 > 09:06:55.782751-05 | 2020-03-19 08:26:56.268446-04 > (1 row) > > On Thu, Mar 19, 2020 at 8:21 AM Eckert, Doug <doug.eck...@dowjones.com> > wrote: > >> 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 <j.a.v....@marin.nl> >> 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 | j.a.v....@marin.nl | 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:* spacewalk-list-boun...@redhat.com < >>> spacewalk-list-boun...@redhat.com> on behalf of Eckert, Doug < >>> doug.eck...@dowjones.com> >>> *Sent:* Thursday, March 19, 2020 13:08 >>> *To:* spacewalk-list@redhat.com >>> *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 >>> Spacewalk-list@redhat.com >>> 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: doug.eck...@dowjones.com <cbergstres...@newscorp.com> >> A: PO Box 300, Princeton, NJ 08543 >> > > > -- > 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: doug.eck...@dowjones.com <cbergstres...@newscorp.com> > A: PO Box 300, Princeton, NJ 08543 > -- 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: doug.eck...@dowjones.com <cbergstres...@newscorp.com> A: PO Box 300, Princeton, NJ 08543
_______________________________________________ Spacewalk-list mailing list Spacewalk-list@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-list