From 1928dcfa1073619c3844f9bb3207cf7300c8148c Mon Sep 17 00:00:00 2001 From: pedrocarlo Date: Mon, 21 Apr 2025 23:05:01 -0300 Subject: [PATCH] Correct docs regarding between --- COMPAT.md | 2 +- core/translate/expr.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/COMPAT.md b/COMPAT.md index ced9fbb6d..799411193 100644 --- a/COMPAT.md +++ b/COMPAT.md @@ -200,7 +200,7 @@ Feature support of [sqlite expr syntax](https://www.sqlite.org/lang_expr.html). | (NOT) MATCH | No | | | IS (NOT) | Yes | | | IS (NOT) DISTINCT FROM | Yes | | -| (NOT) BETWEEN ... AND ... | No | | +| (NOT) BETWEEN ... AND ... | Yes | Expression is rewritten in the optimizer | | (NOT) IN (subquery) | No | | | (NOT) EXISTS (subquery) | No | | | CASE WHEN THEN ELSE END | Yes | | diff --git a/core/translate/expr.rs b/core/translate/expr.rs index 6c9072ab9..53deb7e0f 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -186,7 +186,9 @@ pub fn translate_condition_expr( resolver: &Resolver, ) -> Result<()> { match expr { - ast::Expr::Between { .. } => todo!(), + ast::Expr::Between { .. } => { + unreachable!("expression should have been rewritten in optmizer") + } ast::Expr::Binary(lhs, ast::Operator::And, rhs) => { // In a binary AND, never jump to the parent 'jump_target_when_true' label on the first condition, because // the second condition MUST also be true. Instead we instruct the child expression to jump to a local @@ -492,7 +494,9 @@ pub fn translate_expr( return Ok(target_register); } match expr { - ast::Expr::Between { .. } => todo!(), + ast::Expr::Between { .. } => { + unreachable!("expression should have been rewritten in optmizer") + } ast::Expr::Binary(e1, op, e2) => { // Check if both sides of the expression are equivalent and reuse the same register if so if exprs_are_equivalent(e1, e2) {