Update auto generated primary key with custom primary key | Community
Skip to main content
January 27, 2021
Solved

Update auto generated primary key with custom primary key

  • January 27, 2021
  • 1 reply
  • 1317 views

Hi,

We are migrating our logs from On-prem adobe campaign classic instance to hosted adobe campaign classic instance. in that process we are facing an issue while updating the auto generated primary key of tracking log schema with our existing on-prem primary key of tracking logs. we are updating this by using dataloading activity and updating the primary key with the help of foreign key of deliveryId and foreign key of urlId, we are facing the following error "PGS-220000 PostgreSQL error: ERROR: duplicate key value violates unique constraint "nmstrackinglogrcp_id" DETAIL: Key (itrackinglogid)=('1234567') already exists."

 

Kindly help us to resolve the issue

 

Thanks!!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jonathon_wodnicki

Hi,

 

Find the highest ID in the table:

select max(itrackinglogid) from nmstrackinglogrcp;

 

Then update sequence to start 1 higher:

alter sequence NmsTrackingLogId restart with 9000;

 

Thanks,

-Jon

 

1 reply

Jonathon_wodnicki
Community Advisor
Jonathon_wodnickiCommunity AdvisorAccepted solution
Community Advisor
February 2, 2021

Hi,

 

Find the highest ID in the table:

select max(itrackinglogid) from nmstrackinglogrcp;

 

Then update sequence to start 1 higher:

alter sequence NmsTrackingLogId restart with 9000;

 

Thanks,

-Jon