Use lowercase schema name if db is postgres. Hold the schemaname in TaskanaEngineConfiguration in lower case...

This commit is contained in:
BerndBreier 2019-02-26 13:28:23 +01:00 committed by Holger Hagen
parent 70c715239b
commit efc121257d
1 changed files with 12 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.Duration;
import java.time.Instant;
@ -282,6 +283,17 @@ public class TaskanaEngineConfiguration {
this.setSchemaName(DEFAULT_SCHEMA_NAME);
}
try (Connection connection = dataSource.getConnection()) {
String databaseProductName = connection.getMetaData().getDatabaseProductName();
if (TaskanaEngineImpl.isPostgreSQL(databaseProductName)) {
this.schemaName = this.schemaName.toLowerCase();
} else {
this.schemaName = this.schemaName.toUpperCase();
}
} catch (SQLException ex) {
LOGGER.error("Caught {} when attempting to initialize the schema name", ex);
}
LOGGER.debug("Using schema name {}", this.getSchemaName());
}