ejbca-ce icon indicating copy to clipboard operation
ejbca-ce copied to clipboard

Upgrade fails to remove index on PostgreSQL

Open benoiton opened this issue 2 years ago • 3 comments

When automatically upgrading database, the action (in UpgradeSessionBean) fails.

DROP INDEX <index_name> ON <table_name> syntax is wrong for PostgreSQL: ON <table_name> is not expected. It does exist with MariaDB and MSSQL.

benoiton avatar Nov 17 '23 15:11 benoiton

Just checked and it looks like the upgrade only prints an error here. So if you drop the index manually it is done. We're looking at how to improve this though. Thanks for the report.

primetomas avatar Nov 21 '23 15:11 primetomas

In ejbca-common/src/org/ejbca/util/DatabaseIndexUtil.java, you have already have code to test product name:

if (databaseMetaData.getDatabaseProductName().equalsIgnoreCase(ORACLE) &&
                    databaseMetaData.getDatabaseMajorVersion() >= ORACLE_VERSION) {

I supposed it could be OK to define dropCrlDataIndex query string depending on ProductName value.

benoiton avatar Nov 21 '23 18:11 benoiton

Thanks for finding that. We'll work on moving the drop index there and supporting more databases.

primetomas avatar Nov 22 '23 10:11 primetomas

Fixed for EJBCA 8.3 in https://jira.primekey.se/browse/ECA-12323

primetomas avatar Mar 25 '24 19:03 primetomas