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
#[sqlx(default)] attribute is supposed to use default value for the type instead of taking it from the query but it doesn't, and causes missing field error.
Minimal Reproduction
#[derive(sqlx::FromRow)]structFoo{id:i32,#[sqlx(default)]name:Option<String>,}#[tokio::main(flavor = "current_thread")]asyncfnmain(){let pg = sqlx::PgPool::connect("postgres://testing@localhost/testing").await;
sqlx::query_as!(Foo,"SELECT id FROM Foo");}
Table foo was created with like that
createtablefoo(id SERIALPRIMARY KEY, name TEXTNOT NULL);
Bug Description
#[sqlx(default)]
attribute is supposed to use default value for the type instead of taking it from the query but it doesn't, and causes missing field error.Minimal Reproduction
Table
foo
was created with like thatInfo
rustc --version
: rustc 1.78.0-nightly (3cbb93223 2024-03-13)The text was updated successfully, but these errors were encountered: