Migration - PostgreSQL 10.x - PSQLException: Returning autogenerated keys is only supported for 8.2 and later servers

marielle.spiteri
Blog Categories: 

Component: Migration Tool | Version: N/A

I am unable to use the migration tool on my PostgreSQL 10.x server.

There are these messages in the migration-2019-03-13-104435.log file:

[INFO] | Execute migration step: Add Kerberos default configuration
Mar 13, 2019 10:44:39 AM groovy.sql.Sql executeInsert
WARNING: Failed to execute: INSERT INTO configuration(tenant_id,content_type,resource_name,resource_content) VALUES (?, ?, ?, ?) because: Returning autogenerated keys is only supported for 8.2 and later servers.
Mar 13, 2019 10:44:39 AM groovy.sql.Sql eachRow
WARNING: Failed to execute: 
                SELECT tenant_id, content_type, resource_content
                FROM configuration
                WHERE resource_name='authenticationManager-config.properties'
                 because: Returning autogenerated keys is only supported for 8.2 and later servers.
Exception in thread "main" org.postgresql.util.PSQLException: Returning autogenerated keys is only supported for 8.2 and later servers.
    at org.postgresql.jdbc3.AbstractJdbc3Statement.addReturning(AbstractJdbc3Statement.java:151)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareStatement(AbstractJdbc3Connection.java:364)
    at org.apache.commons.dbcp2.DelegatingConnection.prepareStatement(DelegatingConnection.java:743)
    at org.apache.commons.dbcp2.DelegatingConnection.prepareStatement(DelegatingConnection.java:743)
    at groovy.sql.Sql$CreatePreparedStatementCommand.execute(Sql.java:4508)
    at groovy.sql.Sql$CreatePreparedStatementCommand.execute(Sql.java:4496)
    at groovy.sql.Sql.getAbstractStatement(Sql.java:4347)
    at groovy.sql.Sql.getPreparedStatement(Sql.java:4362)
    at groovy.sql.Sql.executeInsert(Sql.java:2597)
    at groovy.sql.Sql.executeInsert(Sql.java:2800)
    at groovy.sql.Sql$executeInsert$7.call(Unknown Source)
[...]

Answer

As per Bonita supported Hardware and software requirements matrix (https://documentation.bonitasoft.com/bonita/7.8/hardware-and-software-re...) , PostgreSQL supported version are 9.3 and higher in the 9.3.x line.
So the jdb driver postgresql-9.3-1102-jdbc41.jar that is provided in the product out of the box (in the bundles and in the migration tool), is only compatible for these versions.

Resolution

When you use PostgreSQL 10.x, you need to use the relevant jdbc driver for your version.

1.Go to PostgreSQL JDBC driver download page: https://jdbc.postgresql.org/download.html
Download the driver that supports your PostgreSQL version (version 42.2.x)
2. Restore the platform in the origin version with the BACKUP done in step 10 of the Migration procedure: https://documentation.bonitasoft.com/bonita/7.8/migrate-from-an-earlier-...
3. Once the origin platform is fully restored, replace the driver in the migration tool:
Remove: bonita-migration-distrib-sp-2.xx.x/lib/postgresql-9.3-1102-jdbc41.jar
Replace it by the driver downloaded in step 1: bonita-migration-distrib-sp-2.xx.x/lib/postgresql-42.2.4.jar
4. Re-do the migration from the start: https://documentation.bonitasoft.com/bonita/7.8/migrate-from-an-earlier-...

Notifications