The Problem
SeaQuery’s like() and not_like() methods only accept string patterns via LikeExpr. This meant users couldn’t use column references, function calls, concatenation, or other SQL expressions as LIKE patterns — a common need when building dynamic queries like WHERE column LIKE other_column || '%'.
This limitation was tracked in issue #464.
The Solution
Added new _expr variants to the LIKE family of methods:
like_expr()andnot_like_expr()onExprTraitfor all backendsilike_expr()andnot_ilike_expr()onPgExprfor Postgres case-insensitive matching
All new methods accept Into<Expr>, enabling arbitrary expressions as LIKE patterns:
// Column reference as LIKE pattern
Expr::col(Character::Character).like_expr(Expr::col(Character::FontId))
// Function call as pattern
Expr::col(Character::Character).like_expr(Func::lower(Expr::col(Character::FontId)))
// Concatenation as pattern
Expr::col(Character::Character).like_expr(
Expr::col(Character::FontId).concat("%")
)
The implementation follows the same self.binary(Op, right) pattern used by existing comparison operators (eq(), gt(), etc.). No breaking changes — existing like()/not_like() methods remain unchanged.
Tests cover all three backends (MySQL, Postgres, SQLite) with column references, function expressions, string literals, and concatenation patterns.
Timeline
| Date | Action |
|---|---|
| 2026-03-23 | PR submitted with implementation and tests |