Skip to content

Commit 1ee3df3

Browse files
committed
Change server drop for statement cache error to a deallocate all
1 parent a57550d commit 1ee3df3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/server.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,12 @@ impl Server {
974974
let error_message = crate::messages::PgErrorMsg::parse(&message)?;
975975
if error_message.message == "cached plan must not change result type" {
976976
warn!("Server {:?} changed schema, dropping connection to clean up prepared statements", self.address);
977-
// This will still result in an error to the client, but this server connection
978-
// will be dropped, and will not bleed into the pool.
979-
// TODO: Other ideas to solve issues with DDL changes when using prepared statements
980-
// - Recreate connection pool to force recreation of server connections
981-
// - Just close the prepared statement instead of dropping the connection
982-
// - Implement a retry so the client doesn't see an error
983-
self.mark_bad();
977+
// This will still result in an error to the client, but this server connection will drop all cache prepared statements
978+
// so that any new queries will be re-prepared
979+
// TODO: Other ideas to solve errors when there DDL changes after a statement has been prepared
980+
// - Recreate entire connection pool to force recreation of all server connections
981+
// - Implement a retry (re-prepare) so the client doesn't see an error
982+
self.cleanup_state.needs_cleanup_prepare = true;
984983
}
985984
}
986985
}

0 commit comments

Comments
 (0)