Skip to content

Commit

Permalink
Add test case for issue 776 (#786)
Browse files Browse the repository at this point in the history
I am adding a tiny test that uses the SQL statement that was reported to break an older version of SQL parser library

#776
  • Loading branch information
drdrsh authored Aug 31, 2024
1 parent c051290 commit 2def40e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/query_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,19 @@ mod test {
assert!(!qr.query_parser_enabled());
}

#[test]
fn test_query_parser() {
QueryRouter::setup();
let mut qr = QueryRouter::new();
qr.pool_settings.query_parser_read_write_splitting = true;

let query = simple_query("SELECT req_tab_0.* FROM validation req_tab_0 WHERE array['http://www.w3.org/ns/shacl#ValidationResult'] && req_tab_0.type::text[] AND ( ( (req_tab_0.focusnode = 'DataSource_Credilogic_DataSourceAddress_144959227') ) )");
assert!(qr.infer(&qr.parse(&query).unwrap()).is_ok());

let query = simple_query("WITH EmployeeSalaries AS (SELECT Department, Salary FROM Employees) SELECT Department, AVG(Salary) AS AverageSalary FROM EmployeeSalaries GROUP BY Department;");
assert!(qr.infer(&qr.parse(&query).unwrap()).is_ok());
}

#[test]
fn test_update_from_pool_settings() {
QueryRouter::setup();
Expand Down

0 comments on commit 2def40e

Please sign in to comment.