Skip to content

Commit db70499

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

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/server.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -971,16 +971,15 @@ impl Server {
971971
}
972972

973973
if self.prepared_statement_enabled {
974-
let error_message = crate::messages::PgErrorMsg::parse(&message)?;
974+
let error_message = 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)