-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
I have found these related issues/pull requests
This issue and the patch seem to apply only to query_as, not the query_as! macro.
Description
Calling fetch on query_as makes it possible to handle errors in the stream to avoid one bad record preventing a partial result from being returned. Using the query_as! macro, the fetch method returns a stream that stops producing records at the first error, which means any error handling stream will never see the error. Streaming query_as results works properly because of #1887 but the same bug still exists with query_as!.
I can try to take a hack at a fix but I'm not familiar with how the query macros work at the moment. Any tips/hints would be graciously accepted.
Reproduction steps
Here's a gist.
The 5th and 10th records inserted into the table are missing a required field. Collecting the results from the query_as! stream has only 4 entries, whereas query_as returns 8--the 8 records that have the required fields, minus the two that are missing it.
SQLx version
0.8.6
Enabled SQLx features
postgres, macros, json, derive, runtime-tokio
Database server and version
PostgreSQL 16.11
Operating system
Debian 12.2.0
Rust version
rustc 1.93.0-nightly