#[non_exhaustive]pub enum PgRecycling {
Fast,
Verified,
Clean,
}Expand description
How the pool validates a connection when it is checked out again.
None of these methods roll back an open transaction; Clean resets
session state but runs inside whatever transaction is still open.
Session state and multi-tenant / RLS use. Under Fast and Verified,
session state (SET, SET ROLE, search_path, custom GUCs such as a
tenant id read by row-level-security policies, advisory locks, temp
tables) persists across checkouts: the next caller of the same physical
connection inherits it. If you rely on such state for isolation, use
PgRecycling::Clean or scope it with SET LOCAL inside a transaction.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Fast
Only discard connections that are already closed (default).
Does not reset session state; see the type-level warning about
leaking SET / SET ROLE / tenant GUCs between checkouts. Prefer
PgRecycling::Clean for RLS or tenant-scoped workloads.
Verified
Run a trivial query to verify the connection is alive.
The check is bounded by PoolConfig::recycle_timeout. Session
state is not reset (see the type-level warning).
Clean
Verified plus a session-state reset: closes cursors, resets
session settings and authorization, UNLISTEN *, releases advisory
locks, and drops temp tables and sequence state. Prepared
statements are preserved, so Prax’s statement cache stays valid.
The check and reset are bounded by PoolConfig::recycle_timeout.
Recommended for RLS / tenant users.
Trait Implementations§
Source§impl Clone for PgRecycling
impl Clone for PgRecycling
impl Copy for PgRecycling
Source§impl Debug for PgRecycling
impl Debug for PgRecycling
Source§impl Default for PgRecycling
impl Default for PgRecycling
impl Eq for PgRecycling
Source§impl PartialEq for PgRecycling
impl PartialEq for PgRecycling
impl StructuralPartialEq for PgRecycling
Auto Trait Implementations§
impl Forget for PgRecycling
impl Freeze for PgRecycling
impl Move for PgRecycling
impl RefUnwindSafe for PgRecycling
impl Send for PgRecycling
impl Sync for PgRecycling
impl Unpin for PgRecycling
impl UnsafeUnpin for PgRecycling
impl UnwindSafe for PgRecycling
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.