SonarQube DB Copy Tool runs into an exception

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) => SonarQube Community v25.11.0.114957 + Delphi plugin (v1.18.3)
  • how is SonarQube deployed: zip, Docker, Helm => Docker
  • what are you trying to achieve => We are trying to migrate the data from our MS SQL database to a new PostgreSQL database
  • what have you tried so far to achieve this => We deployed a new PostgreSQL database in Docker (same stack as our SonarQube instance), then used a temporary SonarQube instance (same version as our productive one) to get the schema into the new DB. Then we ran the SonarQube DB Copy Tool (v1.6.0.2092) to copy the existing data to the new DB, which seemed to work fine at first, but eventually ran into an error (see log).

The full log is attached; the error message can be found at the end:

23:18:35 INFO  issue_changes                 0 / 40558
23:18:42 INFO  issue_changes                 40558 / 40558 (5921.43 rps)
23:18:43 INFO  issues                        0 / 22883
23:18:48 INFO  issues                        22883 / 22883 (4203.21 rps)
23:18:49 INFO  issues_fixed                  0 / 0
23:18:49 INFO  issues_fixed                  0 / 0 (NaN rps)
23:18:49 INFO  issues_impacts                0 / 22910
23:18:52 INFO  issues_impacts                22910 / 22910 (8079.71 rps)
23:18:53 INFO  jira_org_bindings             0 / 0
23:18:53 INFO  jira_org_bindings             0 / 0 (NaN rps)
Exception in thread "main" com.sonar.dbcopy.utils.toolconfig.SqlDbCopyException: Problem to execute the adjustment of autoincrement  with last id +1 :ALTER SEQUENCE null RESTART WITH 1; at TABLE : jira_org_bindings.
        at com.sonar.dbcopy.reproduce.process.SequenceReseter.execute(SequenceReseter.java:66)
        at com.sonar.dbcopy.reproduce.process.LoopByTable.execute(LoopByTable.java:89)
        at com.sonar.dbcopy.StartApp.main(StartApp.java:116)
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "null"
  Position: 16
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:333)
        at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:319)
        at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:295)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:290)
        at com.sonar.dbcopy.reproduce.process.SequenceReseter.execute(SequenceReseter.java:63)
        ... 2 more

DB Migration.txt (108.9 KB)

Hi,

Do you have both DBs at the same SonarQube version?

 
Ann

Hi Ann, both DBs use SonarQube version 25.11.0.114957.

Hi,

Okay, thanks for confirming. I’ve flagged this for the team.

 
Ann

1 Like

Hello @jam first thing, sorry for the late reply on this topic.

This problem is not something that I recognize easily, the table mentioned in the error jira_org_bindings was introduced in 25.11 I need to check with the Squad that worked on this topic all the characteristics of it.
From a first look I don’t see anything trivial related to autoincrement fields.

I will come back to this topic as soon as I have more details.
I will try also to reproduce locally.
What I find very weird is the fact that the table is even empty in your case, so really not sure what is going on there.

1 Like

@jam may I ask you the versions of the Databases you are using?
Both MsSQL and Postgres.

The source database is an MS SQL Server 2019 (product version: 15.0.4455.2). We tried it with the postgres:16-alpine docker image for PostgreSQL and ran into this problem.

Thanks for checking.
We can exclude the version of the DB as a source of the problem.

A first investigation was done and the issue was probably related to the name of a column in the table creating the issue. If this is confirmed we will release an updated version of sonar-db-copy to make sure that you are able to copy your databases.

I will add here more details as soon as they are available.

2 Likes

Hello, do you have some news ?

I have exactly the same issue.

Thank you.

Dear all thanks again for highlighting this issue,

The issue is being tracked under this Jira: SDBC-105

We will prioritize accordingly to all the other tasks already in our pipelines.
We are aware that this makes Sonar DB Copy broken with the latest versions of the database.

By monitoring the status of the Jira you will be informed about the updates on this topic.

2 Likes