Skip to content

Add support for typing using sqlite RETURNING clause #1246

Closed
@fabi321

Description

@fabi321

minimal steps to reproduce:

struct Rowid {
    rowid: i64,
}

#[async_std::main]
async fn main() {
    let pool = sqlx::SqlitePool::connect("file::memory:").await.unwrap();
    sqlx::query!("CREATE TABLE IF NOT EXISTS test (rowid INTEGER PRIMARY KEY);")
        .execute(&pool)
        .await
        .unwrap();

    sqlx::query_as!(
        Rowid,
        "INSERT INTO test (rowid) VALUES (42) RETURNING rowid"
    ).fetch_one(&pool).await.unwrap();
}

this with a test database with the first statement executed will yield
error: unsupported type NULL of column #1 ("rowid")

sqlx version: 0.5.5
libsqlite3 version: 3.35.4 (libsqlite3-sys 0.22.2)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions