fix: Fix DuckDB incorrect pg password encoding (#8028)

This commit is contained in:
Diego Imbert
2026-02-20 11:35:27 +01:00
committed by GitHub
parent 795abccc19
commit 90b1a7a531
2 changed files with 3 additions and 27 deletions
-24
View File
@@ -404,30 +404,6 @@ impl PgDatabase {
)
}
pub fn to_conn_str(&self) -> String {
format!(
"dbname={dbname} {user} host={host} {password} {port} {sslmode}",
dbname = self.dbname,
user = self
.user
.as_ref()
.map(|u| format!("user={}", urlencoding::encode(u)))
.unwrap_or_default(),
host = self.host,
password = self
.password
.as_ref()
.map(|p| format!("password={}", urlencoding::encode(p)))
.unwrap_or_default(),
port = self.port.map(|p| format!("port={}", p)).unwrap_or_default(),
sslmode = self
.sslmode
.as_ref()
.map(|s| format!("sslmode={}", s.clone()))
.unwrap_or_default(),
)
}
pub async fn connect(
&self,
) -> Result<(tokio_postgres::Client, TokioPgConnection), error::Error> {
@@ -10,8 +10,6 @@ use serde_json::value::RawValue;
use serde_json::{json, Value};
use uuid::Uuid;
use windmill_common::error::{to_anyhow, Error, Result};
use windmill_types::s3::S3Object;
use windmill_object_store::S3_PROXY_LAST_ERRORS_CACHE;
use windmill_common::utils::sanitize_string_from_password;
use windmill_common::worker::{Connection, SqlResultCollectionStrategy};
use windmill_common::workspaces::{
@@ -19,8 +17,10 @@ use windmill_common::workspaces::{
DucklakeCatalogResourceType,
};
use windmill_common::PgDatabase;
use windmill_object_store::S3_PROXY_LAST_ERRORS_CACHE;
use windmill_parser_sql::{parse_duckdb_sig, parse_sql_blocks};
use windmill_queue::{CanceledBy, MiniPulledJob};
use windmill_types::s3::S3Object;
use crate::agent_workers::{get_datatable_resource_from_agent_http, get_ducklake_from_agent_http};
use crate::common::{build_args_values, get_reserved_variables, OccupancyMetrics};
@@ -419,7 +419,7 @@ fn format_attach_db_conn_str(db_resource: Value, db_type: &str) -> Result<String
let s = match db_type.to_lowercase().as_str() {
"postgres" | "postgresql" => {
let res: PgDatabase = serde_json::from_value(db_resource)?;
res.to_conn_str()
res.to_uri()
}
#[cfg(feature = "mysql")]
"mysql" => {