From af2f66661cf26af3e7808d0337f00cd5ba58d7e3 Mon Sep 17 00:00:00 2001 From: ljl <17743125563@163.com> Date: Wed, 11 Dec 2024 15:32:44 +0800 Subject: [PATCH] spi-stats:fix validate sql. --- backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs b/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs index 0a18c3b3..b9f81147 100644 --- a/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs +++ b/backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs @@ -362,6 +362,9 @@ fn process_sql(sql: &str, fact_record: &HashMap) -> TardisResult< /// validate fact and fact col sql pub(crate) fn validate_select_sql(sql: &str) -> bool { + if sql.is_empty() { + return true; + } let re = Regex::new(r"(?i)^\s*select\b").expect("should compile regex"); re.is_match(&sql) }