diff --git a/core/translate/expr.rs b/core/translate/expr.rs index 19e4dc160..3db50331d 100644 --- a/core/translate/expr.rs +++ b/core/translate/expr.rs @@ -74,12 +74,12 @@ pub fn translate_condition_expr( } ast::Expr::Binary(lhs, op, rhs) => { let lhs_reg = program.alloc_register(); - let rhs_reg = program.alloc_register(); let _ = translate_expr(program, Some(referenced_tables), lhs, lhs_reg, cursor_hint); match lhs.as_ref() { ast::Expr::Literal(_) => program.mark_last_insn_constant(), _ => {} } + let rhs_reg = program.alloc_register(); let _ = translate_expr(program, Some(referenced_tables), rhs, rhs_reg, cursor_hint); match rhs.as_ref() { ast::Expr::Literal(_) => program.mark_last_insn_constant(), diff --git a/testing/like.test b/testing/like.test index 09fd6af00..3863adf27 100755 --- a/testing/like.test +++ b/testing/like.test @@ -22,6 +22,11 @@ do_execsql_test where-like { } {4|sweater|25.0 5|sweatshirt|74.0} +do_execsql_test where-like-fn { + select * from products where like('sweat%', name)=1 +} {4|sweater|25.0 +5|sweatshirt|74.0} + do_execsql_test where-not-like-and { select * from products where name not like 'sweat%' and price >= 70.0; } {1|hat|79.0