Skip to content

[BUG] 'gen_random_uuid()' Constraint Error: Duplicate key #331

@wyhaya

Description

@wyhaya
[dependencies]
duckdb = { version = "0.10.2", features = ["bundled"] }
use duckdb::Connection;

fn main() {
    let conn = Connection::open_in_memory().unwrap();
    conn.execute("CREATE TABLE test (id uuid primary key default gen_random_uuid())", []).unwrap();
    for _ in 0..999999 {
        conn.execute("insert into test default values", []).unwrap();
    }
}
cargo run --release
thread 'main' panicked at src/main.rs:12:61:
called `Result::unwrap()` on an `Err` value: DuckDBFailure(Error { code: Unknown, extended_code: 1 }, 
Some("Constraint Error: Duplicate key \"id: 620e391f-bf1c-412e-9fc3-917224f99a1c\" violates primary key constraint.
If this is an unexpected constraint violation please double check with the known index limitations section in our documentation (https://duckdb.org/docs/sql/indexes)."))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In fact, I'm not quite sure whether this bug should belong to duckdb-rs, but I'm unfamiliar with C++, and I can't check it further, so I posted it here.

macOS 14.5
select version() -> v0.10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions