You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATETABLEfoo (
id TEXTPRIMARY KEY,
bar INTEGER,
baz INTEGER
);
INSERT INTO foo (id, bar, baz) VALUES ('001', 100, 100);
INSERT INTO foo (id, bar, baz) VALUES ('002', null, 100);
Rust:
structFoo{bar:Option<i32>,baz:Option<i32>,}letmut pool = PgPool::new(env!("DATABASE_URL")).await.unwrap();let row = sqlx::query_as!(Foo, "select bar, baz from foo where id = '001'").fetch_one(&mut pool).await.unwrap();assert_eq!(row.bar, Some(100));assert_eq!(row.baz, Some(100));let row = sqlx::query_as!(Foo, "select bar, baz from foo where id = '002'").fetch_one(&mut pool).await.unwrap();assert_eq!(row.bar, None);assert_eq!(row.baz, Some(100));// error
SQL:
Rust:
Error:
FYI, I'm using PostgreSQL 12.1 on ArchLinux.
The text was updated successfully, but these errors were encountered: