diff --git a/core/storage/sqlite3_ondisk.rs b/core/storage/sqlite3_ondisk.rs index d71cd615a..9e0e695a3 100644 --- a/core/storage/sqlite3_ondisk.rs +++ b/core/storage/sqlite3_ondisk.rs @@ -248,7 +248,7 @@ pub enum PageType { } impl TryFrom for PageType { - type Error = crate::error::LimboError; + type Error = LimboError; fn try_from(value: u8) -> Result { match value { diff --git a/core/translate/expr.rs b/core/translate/expr.rs index b06f972e8..667619d75 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -537,6 +537,17 @@ pub fn translate_condition_expr( ); } } + ast::Expr::Parenthesized(exprs) => { + for expr in exprs { + let _ = translate_condition_expr( + program, + referenced_tables, + expr, + cursor_hint, + condition_metadata, + ); + } + } _ => todo!("op {:?} not implemented", expr), } Ok(()) diff --git a/testing/where.test b/testing/where.test index bbcc32eba..4cb5d1978 100755 --- a/testing/where.test +++ b/testing/where.test @@ -252,4 +252,18 @@ do_execsql_test where_multiple { do_execsql_test where_multiple_flipped { select id, first_name, age from users where age < 50 and id = 5; -} {5|Edward|15} \ No newline at end of file +} {5|Edward|15} + +do_execsql_test where-parentheses-and { + select id, name from products where (id = 5 and name = 'sweatshirt') and (id = 5 and name = 'sweatshirt') ORDER BY id; +} {5|sweatshirt} + +do_execsql_test where-nested-parentheses { + select id, name from products where ((id = 5 and name = 'sweatshirt') or (id = 1 and name = 'hat')) ORDER BY id; +} {1|hat +5|sweatshirt} + +do_execsql_test where-complex-parentheses { + select id, name from products where ((id = 5 and name = 'sweatshirt') or (id = 1 and name = 'hat')) and (name = 'sweatshirt' or name = 'hat') ORDER BY id; +} {1|hat +5|sweatshirt}