diff --git a/tokio-postgres/src/client.rs b/tokio-postgres/src/client.rs index 359a7cd1..f11e5736 100644 --- a/tokio-postgres/src/client.rs +++ b/tokio-postgres/src/client.rs @@ -113,6 +113,10 @@ impl InnerClient { self.state.lock().types.insert(oid, type_.clone()); } + pub fn clear_types(&self) { + self.state.lock().types.clear(); + } + pub fn with_buf(&self, f: F) -> R where F: FnOnce(&mut BytesMut) -> R, @@ -176,6 +180,11 @@ impl Client { &self.inner } + /// Clears the cache of database types (domain, enum, composition) that are loaded when preparing a query. + pub fn clear_types_cache(&self) { + self.inner().clear_types() + } + #[cfg(feature = "runtime")] pub(crate) fn set_socket_config(&mut self, socket_config: SocketConfig) { self.socket_config = Some(socket_config);