Skip to content

Commit

Permalink
Add ValidGrouping to boxed having expression
Browse files Browse the repository at this point in the history
  • Loading branch information
obsoleszenz committed Apr 18, 2024
1 parent 5d6637f commit 0799a44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions diesel_tests/tests/boxed_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ fn can_box_query_with_boxable_expression() {
fn can_box_query_having_with_boxable_expression() {
let connection = &mut connection_with_sean_and_tess_in_users_table();

let expr: Box<dyn BoxableExpression<users::table, _, SqlType = _>> =
use diesel::expression::ValidGrouping;
let expr: Box<dyn BoxableExpression<users::table, <users::id as ValidGrouping<(users::id)>>::IsAggregate, SqlType = _>> =
Box::new(count(users::id).eq(2)) as _;

use diesel::dsl::count;
let data: Vec<i64> = users::table.select(count(users::id)).group_by(users::id).having(expr).into_boxed().load(connection).expect("db error");
let data: Vec<i64> = users::table.select(count(users::id)).group_by(users::id).into_boxed().having(expr).load(connection).expect("db error");
}

0 comments on commit 0799a44

Please sign in to comment.