Skip to content

Commit 3f43fa4

Browse files
committed
Use null catalog when catalog is empty in TableColumnTypeValidationTest
This aligns with other places in our production code where we only use the provided catalog value if it is not empty. There has been a change in Postgres in how it handles catalog with empty value. See pgjdbc/pgjdbc#3390
1 parent 052da7f commit 3f43fa4

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

modules/flowable-app-rest/src/test/java/org/flowable/test/persistence/TableColumnTypeValidationTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,18 @@ protected Map<String, String> internalGetColumnMetaData(String tableName) {
196196
if (StringUtils.isNotEmpty(databaseTablePrefix)) {
197197
prefixedTableName = databaseTablePrefix + "." + tableName;
198198
}
199-
String catalog = processEngine.getProcessEngineConfiguration().getDatabaseCatalog();
199+
200+
// If the configured catalog is empty, we use null.
201+
// This is the same logic as in the other places where we retrieve metadata
202+
// (e.g., AbstractSqlScriptBasedDbSchemaManager.isTablePresent(String tableName)).
203+
String catalog = StringUtils.defaultIfEmpty(processEngine.getProcessEngineConfiguration().getDatabaseCatalog(), null);
200204
String schema = processEngine.getProcessEngineConfiguration().getDatabaseSchema();
201205
if (StringUtils.isNotEmpty(schema) && AbstractEngineConfiguration.DATABASE_TYPE_ORACLE.equalsIgnoreCase(databaseType)) {
202206
schema = schema.toUpperCase(Locale.ROOT);
203207
}
204208

205209
Map<String, String> columnNameToTypeMap = new HashMap<>();
206210

207-
if (StringUtils.isEmpty(catalog) &&
208-
(databaseType.equals(AbstractEngineConfiguration.DATABASE_TYPE_MSSQL)
209-
|| databaseType.equals(AbstractEngineConfiguration.DATABASE_TYPE_MYSQL))
210-
) {
211-
catalog = null; // Otherwise SQL server errors out
212-
}
213-
214211
ResultSet resultSet = databaseMetaData.getColumns(catalog, schema, prefixedTableName, null);
215212
while (resultSet.next()) {
216213
String columnName = resultSet.getString("COLUMN_NAME");

0 commit comments

Comments
 (0)