Skip to content

Commit

Permalink
Add failing test that we can't select eq_any of a Nullable expression…
Browse files Browse the repository at this point in the history
… into a bool.
  • Loading branch information
Ten0 committed Nov 20, 2024
1 parent 7a5c5a8 commit 6912d7b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions diesel_compile_tests/tests/fail/eq_any_is_nullable.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extern crate diesel;

use diesel::*;

table! {
users{
id -> Integer,
name -> Nullable<Text>,
}
}

fn main() {
let mut conn = PgConnection::establish("").unwrap();
// Should not be allowed because `users::name` is nullable, so the result of `eq_any` is
// nullable as well.
let _: Vec<bool> = users::table
.select(users::name.eq_any(["foo", "bar"]))
.load(&mut conn)
.unwrap();
}

0 comments on commit 6912d7b

Please sign in to comment.