duckdb / duckdb-rs

Ergonomic bindings to duckdb for Rust
MIT License
428 stars 87 forks source link

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

Open wyhaya opened 4 weeks ago

wyhaya commented 4 weeks ago
[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

Swoorup commented 3 weeks ago

Sounds like a problem on https://github.com/duckdb/duckdb