Open boydjohnson opened 3 years ago
Apparently it was the id
and title
that were causing the problem. If I have non-null overrides on all fields query_as compiles. Less of a bug, but still kind of annoying.
Compiles:
sqlx::query_as!(
TodoFull,
r#"SELECT t.id as "id!", t.title as "title!", u.id "user_id!: i32", u.username "username!: String" FROM Todos t INNER JOIN Users u ON t.user_id = u.id LIMIT $1 OFFSET $2"#,
1,
2,
)
.fetch_all(conn)
.await
I'm using sqlx with postgres and have tested this against
postgres:13
andpostgres:12
docker images. Edit: sqlx 0.5.5.My tables look like
This query compiles
this query fails to compile
with errors:
Interestingly,
fetch_all
without a join on the users query doesn't failworks as expected.