N
Neon7mo ago
helpful-purple

How do I turn on protocol-level prepared statements in Diesel?

Diesel statement caching on Neon postgres is returning an error only. When I look at the Neon docs, it says I need to configure the connection to use named prepared statements. I don't see that as an option in Diesel R2D2. Has anyone figured this out?
3 Replies
genetic-orange
genetic-orange7mo ago
@dfb are you referring to https://github.com/sfackler/r2d2-postgres ?
helpful-purple
helpful-purpleOP7mo ago
Yes. I also tried SeoOrm for Rust. https://www.reddit.com/r/rust/comments/1j09uqc/seaorm_versus_diesel_for_pooling/ I believe both Rust crates support SQL prepared statements, but not protocol-level statements. For pooled connections, does Neon have a crate they know works with their config for PG_BOUNCER with example code. My two examples are SeaOrm https://github.com/dfberry/rust/tree/main/crates/crate_axum_seaorm_example and Diesel https://github.com/dfberry/rust/tree/main/crates/crate-postgres-diesel-axum-pool.
Reddit
From the rust community on Reddit: SeaOrm versus Diesel for pooling
Explore this post and more from the rust community
GitHub
rust/crates/crate_axum_seaorm_example at main · dfberry/rust
Contribute to dfberry/rust development by creating an account on GitHub.
genetic-orange
genetic-orange7mo ago
What do you think of https://github.com/neondatabase/examples/tree/main/with-rust ? Does that work well for your use case? (i am not an expert at Rust, but I can ask the team on Monday)

Did you find this page helpful?