How to fix "primary key violated error" for liquibase changeset "Adding composite primary key on Race table"?
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to fix "primary key violated error" for liquibase changeset "Adding composite primary key on Race table"?

 

This problem occurs when duplicate race values added for the same participant more than once. In caTissue, there were no checks or constraints enforced on race, that can add only once for the participant. As a result, when upgrading to more stricter OpenSpecimen, migration of such inconsistent data fails.

To solve the problem, duplicate participant race entries must be cleaned up.  Please execute the below query and restart the Tomcat server to continue the upgrade.

 

delete from catissue_race where rowid not in ( select min(rowid) from catissue_race group by participant_id, race_name );
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com