You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is really nice, but we're getting the old prepared statement "sqlx_s_26" already exists. Initially we tried using sqlx::query().persistent(false), but that's... not for this.
Is there any way to get around (named) prepared statements? Disabling local statement cache does nothing, and persistent is for something else (avoiding writing it to local cache, I presume?)
Would an alternative be to build support for using anonymous prepared statements?
Edit:
After some local testing, the following hack works across a pgbouncer connection:
#[inline]
fn put_statement_name(&mut self, id: Oid) {
// N.B. if you change this don't forget to update it in ../describe.rs
self.extend("".as_bytes()); // anonymous prepared statements have no identifier
self.push(0);
}
I realize that this isn't a solution as-is (obviously) but configuring pg connections with something like anonymous_statement(true) could, perhaps, be a way forward? And then letting that propagating down to wherever necessary? This would also, of course, disable any local statement cache. Is that an option? Is there anything I can do to help here, being a relatively inexperienced Rust developer?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We're accessing our DB from behind PgBouncer, so the question in the title is really the core of it. The syntax of
is really nice, but we're getting the old
prepared statement "sqlx_s_26" already exists
. Initially we tried usingsqlx::query().persistent(false)
, but that's... not for this.Is there any way to get around (named) prepared statements? Disabling local statement cache does nothing, and
persistent
is for something else (avoiding writing it to local cache, I presume?)Would an alternative be to build support for using anonymous prepared statements?
Edit:
After some local testing, the following hack works across a pgbouncer connection:
I realize that this isn't a solution as-is (obviously) but configuring pg connections with something like
anonymous_statement(true)
could, perhaps, be a way forward? And then letting that propagating down to wherever necessary? This would also, of course, disable any local statement cache. Is that an option? Is there anything I can do to help here, being a relatively inexperienced Rust developer?Beta Was this translation helpful? Give feedback.
All reactions