Issue Operations are Failed by the PK Violation of Database

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptom

Unable to do any action on issue, including Edit, Assign, Transit... along with the Primary Key Violation Exception thrown in log file.

1 2 SQL Exception while executing the following: INSERT INTO ***.changegroup (ID, issueid, AUTHOR, CREATED) VALUES (?, ?, ?, ?) (***: unique constraint (***.PK_CHANGEGROUP) violated )

Cause

The cause is the dis-synchronization between the sequence setting and seq_id of changegroup table, which may relate to the incomplete transaction triggered by database connection failure.

Workaround

Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

  1. Run the following SQL in your JIRA database to synchronize sequence setting for changegroup

    1 update SEQUENCE_VALUE_ITEM SET seq_id = (select max(ID) from changegroup) + 10 where seq_name='ChangeGroup'
  2. Restart JIRA.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.