Skip to content

Commit

Permalink
spi-stats:fix validate sql.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Dec 11, 2024
1 parent 4e9349e commit af2f666
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/spi/spi-stats/src/serv/pg/stats_pg_sync_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ fn process_sql(sql: &str, fact_record: &HashMap<String, Value>) -> 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)
}
Expand Down

0 comments on commit af2f666

Please sign in to comment.