SQL equivalents for Jira server's workflow integrity checks

Still need help?

The Atlassian Community is here for you.

Ask the community


The workflow integrity checker is timing out when running in the browser, preventing it from running.


The instance is of a significant size and checks are not able to complete within the timeout period. We have a suggestion to fix this with a progress bar as tracked in  JRA-17593 - Getting issue details... STATUS .


The SQL checks for workflows can be done by manually executing them against the database.

Always back up your data before performing any modification to the database. If possible, try your modifications on a test server.

Workflow Entry States are Correct

  1. This will check for any workflows that have an invalid state, as a result of  JRA-4241 - Getting issue details... STATUS .

    SELECT jiraissue.id issue_id,
    FROM   jiraissue
    JOIN   os_wfentry
    ON     jiraissue.workflow_id = os_wfentry.id
    WHERE  os_wfentry.state IS NULL 
    OR     os_wfentry.state = 0; 
  2. If this returns any records, for example below, they will need to be updated to be valid:

     issue_id | workflow_id |  id   |             name             | initialized | state
        10023 |       10023 | 10023 | jdg-workflow-2-1377070570282 |             |     0
  3. To fix this example, run the following SQL - we need to update the state to be 1 based on the workflow_id. The workflow_id is actually os_wfentry.id.

    UPDATE os_wfentry SET state = 1 WHERE id = 10023;

JIRA Issues with Null Status

  1. This will check if any issues have an invalid issue status, as from  JRA-7428 - Getting issue details... STATUS :

    SELECT jiraissue.id, 
    FROM   jiraissue jiraissue 
    JOIN   os_currentstep currentStep 
    ON     jiraissue.workflow_id = currentStep.entry_id 
    WHERE  jiraissue.issuestatus IS NULL;

  2. And can be fixed with the following:

    UPDATE jiraissue 
    SET    issuestatus = (SELECT state 
                          FROM   os_wfentry 
                          WHERE  id = workflow_id) 
    WHERE  issuestatus IS NULL; 


Last modified on Sep 25, 2019

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.