我已经准备好语句问题与pgBouncer在'事务'池模式。
此 rust 码:
use postgres::{Client, Error, NoTls};
fn main() -> Result<(), Error> {
let mut client = Client::connect(
"postgresql://haproxy@localhost:9435/haproxy",
NoTls,
)?;
for row in client.query("SELECT pg_is_in_recovery() as x;", &[])? {
let x: bool = row.get(0);
println!(
"found app x: {}",
x
);
}
Ok(())
}
失败,错误为:预准备语句"s0"不存在
Error: Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E26000), message: "prepared statement \"s0\" does not exist", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("prepare.c"), line: Some(506), routine: Some("FetchPreparedStatement") }) }
有什么办法吗?
1条答案
按热度按时间jobtbby31#
快!
答案是使用
simple_query
!