Brendonovich / prisma-client-rust

Type-safe database access for Rust
https://prisma.brendonovich.dev
Apache License 2.0
1.75k stars 106 forks source link

[raw query][postgresql]invalid placeholder index #335

Closed KumanoTanaka closed 1 year ago

KumanoTanaka commented 1 year ago

I'm using postgresql and prisma-client-rust.

prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.8", features = ["postgresql", "migrations"], default_features = false }

I faced the sql error when I tried to use the _query_raw feature.

I think the code below should look like ...

https://github.com/Brendonovich/prisma-client-rust/blob/0.6.8/src/raw.rs#L45

        for i in 0..values.len() {
            let variable_indicator = match database {
                "postgresql" => format!("${i + 1}"), // place holder should start with 1 I guess...
Brendonovich commented 1 year ago

Oh whoops, I think you're right. Will change it to 1..=values.len() instead.

Brendonovich commented 1 year ago

Should be fixed in rev = "b982a03f5393c116df52b1d2c45daca7d6d859d4" (though a lot of other changes are also at that commit haha)

KumanoTanaka commented 1 year ago

thank you so much waiting for the next release