Skip to content

Commit

Permalink
Fix for #534 and #535
Browse files Browse the repository at this point in the history
  • Loading branch information
levkk committed Aug 2, 2023
1 parent 9d1c46a commit aefcf42
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pgcat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ username = "sharding_user"
# if `server_password` is not set.
password = "sharding_user"

pool_mode = "session"
pool_mode = "transaction"

# PostgreSQL username used to connect to the server.
# server_username = "another_user"
Expand Down
10 changes: 7 additions & 3 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,9 @@ impl Server {
}
}

self.deallocate(names).await?;
if !names.is_empty() {
self.deallocate(names).await?;
}

Ok(())
}
Expand All @@ -1013,15 +1015,17 @@ impl Server {
/// Close a prepared statement on the server.
pub async fn deallocate(&mut self, names: Vec<String>) -> Result<(), Error> {
for name in &names {
debug!("Deallocating prepared statement `{}`", name);
info!("Deallocating prepared statement `{}`", name);

let close = Close::new(name);
let bytes: BytesMut = close.try_into()?;

self.send(&bytes).await?;
}

self.send(&flush()).await?;
if !names.is_empty() {
self.send(&flush()).await?;
}

// Read and discard CloseComplete (3)
for name in &names {
Expand Down

0 comments on commit aefcf42

Please sign in to comment.