This commit is contained in:
Lev Kokotov
2023-08-01 17:46:34 -07:00
parent 9d1c46a3e9
commit aefcf4281c
3 changed files with 9 additions and 5 deletions

2
Cargo.lock generated
View File

@@ -990,7 +990,7 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]] [[package]]
name = "pgcat" name = "pgcat"
version = "1.1.0" version = "1.1.1"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"async-trait", "async-trait",

View File

@@ -270,7 +270,7 @@ username = "sharding_user"
# if `server_password` is not set. # if `server_password` is not set.
password = "sharding_user" password = "sharding_user"
pool_mode = "session" pool_mode = "transaction"
# PostgreSQL username used to connect to the server. # PostgreSQL username used to connect to the server.
# server_username = "another_user" # server_username = "another_user"

View File

@@ -997,7 +997,9 @@ impl Server {
} }
} }
self.deallocate(names).await?; if !names.is_empty() {
self.deallocate(names).await?;
}
Ok(()) Ok(())
} }
@@ -1013,7 +1015,7 @@ impl Server {
/// Close a prepared statement on the server. /// Close a prepared statement on the server.
pub async fn deallocate(&mut self, names: Vec<String>) -> Result<(), Error> { pub async fn deallocate(&mut self, names: Vec<String>) -> Result<(), Error> {
for name in &names { for name in &names {
debug!("Deallocating prepared statement `{}`", name); info!("Deallocating prepared statement `{}`", name);
let close = Close::new(name); let close = Close::new(name);
let bytes: BytesMut = close.try_into()?; let bytes: BytesMut = close.try_into()?;
@@ -1021,7 +1023,9 @@ impl Server {
self.send(&bytes).await?; self.send(&bytes).await?;
} }
self.send(&flush()).await?; if !names.is_empty() {
self.send(&flush()).await?;
}
// Read and discard CloseComplete (3) // Read and discard CloseComplete (3)
for name in &names { for name in &names {