extdb-importer http://jira.mfd.msk:8088/browse/CLS-821 там вью, без кавычек работает

This commit is contained in:
AKurakin 2025-03-26 18:47:57 +03:00
parent b3bc8f216b
commit 1c4df656b7
2 changed files with 12 additions and 1 deletions

View file

@ -25,6 +25,7 @@ import java.time.Instant;
import java.time.LocalDate;
import java.util.Collection;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.function.Supplier;
@ -73,7 +74,16 @@ public class ExtDBImporterService {
log.warn("maxDate={} too high, set current date", maxDate);
maxDate = LocalDate.now();
}
return String.format("SELECT * FROM \"%s\".\"Crossrate\" where \"Date\">='%s'",
if (schema != null) {
if (!schema.contains("\"") && !schema.toLowerCase(Locale.ROOT).equals(schema)) { // PostgreSQL style with quote
schema = "\"" + schema + "\"";
}
}
if (org.apache.commons.lang3.StringUtils.isEmpty(schema)) {
return String.format("SELECT * FROM crossrate where Date>='%s'",
maxDate);
}
return String.format("SELECT * FROM %s.crossrate where Date>='%s'",
schema, maxDate);
}

View file

@ -11,6 +11,7 @@ extdb-importer.cron.load-from-db-cron=0 0/5 * * * ?
extdb-importer.database.login=clearing
extdb-importer.database.password=Aa111111
extdb-importer.database.schema=CBRInfo
#extdb-importer.database.schema=public
extdb-importer.database.url=jdbc:postgresql://10.200.200.133:5432/clearing?currentSchema=CBRInfo
extdb-importer.database.driver=org.postgresql.Driver