Cannot use column in a like expression
barsdeveloper opened this issue · 0 comments
barsdeveloper commented
Description
A column expression is not accepted in LIKE condition
Steps to Reproduce
I have a table containing strings that are patterns (they contain wildcards like % and _). I need to get only the rows where this pattern column match a string literal
This is a query example that is working in sqlite:
SELECT * FROM request_limit where 'https://api.ibkr.com/v1/api/iserver/account/order/status/123' like target;
I am trying to reproduce this query with the following code:
entities::request_limit::Entity::find()
.select_only()
.column(entities::request_limit::Column::Requests)
.column(entities::request_limit::Column::TimeUnitMs)
.column(entities::request_limit::Column::ConcurrentRequests)
.filter(Expr::value(target).like(Expr::col(entities::request::Column::Target)));
Expected Behavior
Compiles successfully
Actual Behavior
I get an error:
required for `sea_orm::sea_query::Expr` to implement `IntoLikeExpr`