sqlx
sqlx copied to clipboard
`query!` doesn't work with sqlite's `json_each`
Bug Description
When trying to use query! with a query that uses the json_each function, I get this error:
error: error returned from database: (code: 1) no such table column: json_each.value
--> src/db.rs:23:16
|
23 | let recs = sqlx::query!("
| ________________^
24 | | SELECT json_each.value FROM json_each('[1, 2, 3]')
25 | | ");
| |______^
|
The same issue occurs with json_tree.
Minimal Reproduction
sqlx::query!("SELECT json_each.value FROM json_each('[1, 2, 3]')");
Note that running the query directly in sqlite3 via the command line interface works fine. SELECT json('[]') AS blah also works fine from sqlx, so it's not just completely failing at the JSON extension.
Info
- SQLx version: 0.6.2
- SQLx features enabled: ["sqlite", "json", "time", "runtime-tokio-native-tls"]
- Database server and version: sqlite 3.something
- Operating system: NixOS
-
rustc --version: 1.64.0
This still happens to me on 0.8. Any workaround?