Closed ignatz closed 1 month ago
Hi @ignatz!
You are using query
method which return iterator. If you will consume this iterator then it will return the expected error to you on the first attempt.
But in your case you better use exec
method instead which will work as you expect.
You are using query method which return iterator. If you will consume this iterator then it will return the expected error to you on the first attempt.
My bad. That's right :pray:
But in your case you better use exec method instead which will work as you expect.
It will work for this basic example but often I'll want to "INSERT ... RETURNING *". Is there any chance to add a shorthand non-batch version?
let foo : Row = conn.prepare("...").await?.query_row((....)).await?;
Anyway, this is very much a tangent now. Feel free to close and thanks again
I noticed that insert/update queries do not return an error even when they fail due to violated (column) constraints.
PoC: https://github.com/ignatz/libsql_bench/blob/check/src/libsql.rs (sorry, I recycled a PoC from an unrelated bug and it's using libsql 0.3.5 but I promise that I ran into this on 0.5.0 too :) )
In short, defining a table
and running
I would expect a panic, which it doesn't. Note, this is really just about error propagation. The actual insertion does correctly fail when inspecting the table afterwards.
When I do the same with rusqlite, I get:
which is what I would expect.