-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
bugbug:dbInvolves a bug in the database serverInvolves a bug in the database serverdb:sqliteRelated to SQLiteRelated to SQLite
Description
sqlx 6.1 fails when running SQLite returning query with a float which ends with 0.
Works with 1.1, fails with 1.0
// CREATE TABLE data_table(id INTEGER PRIMARY KEY AUTOINCREMENT, number REAL);
#[derive(sqlx::FromRow)]
struct DataTable { id: i64, number: f64 }
#[tokio::main]
async fn main() -> Result<(), sqlx::Error> {
let pool = SqlitePool::connect("sqlite:app.db").await?;
let sql = "insert into data_table (number) values (?) returning id, number";
let _result = sqlx::query_as::<_, DataTable>(sql).bind(1.0).fetch_one(&pool).await?;
Ok(())
}
Error: ColumnDecode { index: "\"number\"", source: "mismatched types; Rust type `f64` (as SQL type `REAL`) is not compatible with SQL type `INTEGER`" }
audkar
Metadata
Metadata
Assignees
Labels
bugbug:dbInvolves a bug in the database serverInvolves a bug in the database serverdb:sqliteRelated to SQLiteRelated to SQLite