diff --git a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java index cd528df6be4..3a7e5a4e6be 100644 --- a/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java +++ b/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/persistence/entity/TableDataManagerImpl.java @@ -85,6 +85,8 @@ public List getTablesPresentInDatabase() { } protected String getTableNameFilter(DatabaseMetaData databaseMetaData, String databaseTablePrefix, String flowableTablePrefix) throws SQLException { + // We are using the search string escape for the filter since the underscore character (_) means match any character when used in LIKE. + // However, we want to get the tables that do have that charactery literally String tableNameFilter; if ("postgres".equals(getDbSqlSession().getDbSqlSessionFactory().getDatabaseType()) || "cockroachdb".equals(getDbSqlSession().getDbSqlSessionFactory().getDatabaseType())) { diff --git a/modules/flowable-engine/src/test/java/org/flowable/examples/mgmt/ManagementServiceTest.java b/modules/flowable-engine/src/test/java/org/flowable/examples/mgmt/ManagementServiceTest.java index 3c9ec2e65ed..a49a9510e31 100644 --- a/modules/flowable-engine/src/test/java/org/flowable/examples/mgmt/ManagementServiceTest.java +++ b/modules/flowable-engine/src/test/java/org/flowable/examples/mgmt/ManagementServiceTest.java @@ -101,7 +101,7 @@ public void testGetTableMetaData() { } @Test - public void testTableCountWithCustomTables() { + public void testTableCountWithCustomTablesWithoutActOrFlwPrefix() { String tablePrefix = processEngineConfiguration.getDatabaseTablePrefix(); try { @@ -120,6 +120,9 @@ public void testTableCountWithCustomTables() { } return null; }); + + // ManagementService#getTableCount returns the counts of the flowable tables (tables with the FLW_ and ACT_ prefix) + // Therefore, the FLWTEST and ACTIVITY_TEST tables should not be included in the table count Map tableCount = managementService.getTableCount(); assertThat(tableCount) .doesNotContainKeys(