Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Custom field exeption

krzysztofzarebski June 10, 2019

Hi,

I do some bulk insert to customfieldoption table. When I'am trying to add some custom value from UI, I get an error that id key already exist. Becouse infact exist. How to set next proper value for this algorytm?

image.png

image.png

2 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2019

This is why you should never write to a Jira database - 99% of the time, people get it wrong.

You should revert to the backup you took before you ran your SQL, this is the only way to get rid of some of the permanent damage you might have done to Jira.

If you insist on bodging this and risking something else going wrong later, then you need to stop your Jira, use SQL again to look for the highest numbered option (in the "id" column) in the options table, then set the options counter in the sequence table to a number at least 11 higher than that.   Restart Jira and run a complete, locking re-index, followed by an integrity check.  There is a good chance (but not 100%) chance this will fix it.  It will if no-one has attempted to use any of the new options yet, but you may still have corrupted data in anything that has been updated since you broke the data.

0 votes
laralg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2019

Hi Krysztof,

Have your reindexed before? Jira might be a bit messed up if you have been inserting things other ways that are not the usual ones, maybe a reindex will get the right ids in order.

 

Regars

krzysztofzarebski June 10, 2019

Yep, I've done reindexing many times 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 16, 2019

You have broken your database, re-indexing won't help because it's just reading from broken data.

Please, restore to the backup you took before running your SQL, it's the only way to safely fix this properly.

Suggest an answer

Log in or Sign up to answer