Merge pull request #6023 from dataease/pr@dev@pgsql

fix: PG SQL数据集,没有根据数据源侧配置的schema 进行正确的读取
This commit is contained in:
taojinlong 2023-09-05 16:22:08 +08:00 committed by GitHub
commit c9caed7ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,10 +13,11 @@ public class PgConfiguration extends JdbcConfiguration {
private String extraParams = ""; private String extraParams = "";
public String getJdbc() { public String getJdbc() {
if(StringUtils.isEmpty(extraParams.trim())){ if(StringUtils.isEmpty(extraParams.trim())){
return "jdbc:postgresql://HOSTNAME:PORT/DATABASE" return "jdbc:postgresql://HOSTNAME:PORT/DATABASE?currentSchema=SCHEMA"
.replace("HOSTNAME", getHost().trim()) .replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim()) .replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim()); .replace("DATABASE", getDataBase().trim())
.replace("SCHEMA", getSchema().trim());
}else { }else {
return "jdbc:postgresql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS" return "jdbc:postgresql://HOSTNAME:PORT/DATABASE?EXTRA_PARAMS"
.replace("HOSTNAME", getHost().trim()) .replace("HOSTNAME", getHost().trim())