From 26b1d20473dc5a6eb28455ee6c9c0018318a6756 Mon Sep 17 00:00:00 2001 From: chenxu Date: Fri, 22 Nov 2024 11:14:23 +0800 Subject: [PATCH] fix query escape Signed-off-by: chenxu --- rust/lakesoul-metadata/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/lakesoul-metadata/src/lib.rs b/rust/lakesoul-metadata/src/lib.rs index 40b659371..e30653d77 100644 --- a/rust/lakesoul-metadata/src/lib.rs +++ b/rust/lakesoul-metadata/src/lib.rs @@ -9,7 +9,7 @@ use postgres_types::{FromSql, ToSql}; use prost::Message; pub use tokio::runtime::{Builder, Runtime}; pub use tokio_postgres::{Client, NoTls, Statement}; -use tokio_postgres::{Error, Row}; +use tokio_postgres::{Error, GenericClient, Row}; use crate::pooled_client::PgConnection; pub use crate::pooled_client::PooledClient; @@ -573,11 +573,11 @@ pub async fn execute_query( m.table_id = $1::text and m.partition_desc = $2::text; "; - let partitions = params[1].to_owned().replace('\'', "''"); + let partitions = params[1].to_owned(); let partitions = partitions .split(PARTITION_DESC_DELIM) .collect::>(); - let statement = client.prepare(&statement).await?; + let statement = client.prepare_cached(&statement).await?; let mut all_rows: Vec = vec![]; for part in partitions { let result = client.query(&statement, &[¶ms[0], &part]).await;