Skip to content

Commit

Permalink
add quaint test
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky committed Nov 15, 2023
1 parent ebea92a commit eb4930a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions quaint/src/visitor/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,4 +1191,15 @@ mod tests {

assert_eq!("SELECT \"User\".*, \"Toto\".* FROM \"User\" LEFT JOIN \"Post\" AS \"p\" ON \"p\".\"userId\" = \"User\".\"id\", \"Toto\"", sql);
}

#[test]
fn enum_cast_text_in_min_max_should_be_outside() {
let enum_col = Column::from("enum").set_is_enum(true).set_is_selected(true);
let q = Select::from_table("User")
.value(min(enum_col.clone()))
.value(max(enum_col));
let (sql, _) = Postgres::build(q).unwrap();

assert_eq!("SELECT MIN(\"enum\")::text, MAX(\"enum\")::text FROM \"User\"", sql);
}
}

0 comments on commit eb4930a

Please sign in to comment.