pub struct CteScope<S: Clone = ()> {
pub rows: CteRowsMap,
pub non_returning_ctes: BindingNameSet,
pub scalar_subqueries: RetainedQueryArena,
pub lock_identities: LockIdentityOptions,
/* private fields */
}Fields§
§rows: CteRowsMap§non_returning_ctes: BindingNameSet§scalar_subqueries: RetainedQueryArena§lock_identities: LockIdentityOptionsImplementations§
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
pub fn command_cte_snapshot(&self) -> Option<Arc<S>>
pub fn set_command_cte_snapshot(&mut self, snapshot: Option<Arc<S>>)
Sourcepub fn set_statement_commands(&mut self, commands: Arc<StatementCommands>)
pub fn set_statement_commands(&mut self, commands: Arc<StatementCommands>)
Make this scope part of the statement whose commands commands holds.
Sourcepub fn statement_commands(&self) -> Option<&Arc<StatementCommands>>
pub fn statement_commands(&self) -> Option<&Arc<StatementCommands>>
The commands of the statement this scope belongs to.
Sourcepub fn statement_wrote(&self, row: &PhysicalDocumentIdentity) -> bool
pub fn statement_wrote(&self, row: &PhysicalDocumentIdentity) -> bool
Whether a command of the statement this scope belongs to wrote row. A later command finds the row’s earlier version in its snapshot, which PostgreSQL reports as TM_SelfModified because the statement’s command id already modified it.
Sourcepub fn statement_triggered_write(&self, row: &PhysicalDocumentIdentity) -> bool
pub fn statement_triggered_write(&self, row: &PhysicalDocumentIdentity) -> bool
Whether a statement that the statement this scope belongs to started wrote row, which PostgreSQL finds modified under a later command id.
pub fn inherit_cte_bindings(&mut self, parent: &Self)
Sourcepub fn inherit_cte_bindings_with_control(
&mut self,
parent: &Self,
control: &ProductionControl<'_>,
) -> Result<(), SQLError>
pub fn inherit_cte_bindings_with_control( &mut self, parent: &Self, control: &ProductionControl<'_>, ) -> Result<(), SQLError>
Admit every private lexical destination before replacing any part of the child scope. Statement and immutable definition owners remain shared with the parent.
Sourcepub fn enter_privilege_subject(
&mut self,
subject: RoleReference,
) -> PrivilegeSubjectScope<'_, S>
pub fn enter_privilege_subject( &mut self, subject: RoleReference, ) -> PrivilegeSubjectScope<'_, S>
Override only relation privilege checks while preserving SQL-visible current_user and the caller’s namespace.
Sourcepub fn enter_privilege_subject_with_control(
&mut self,
subject: Produced<RoleReference>,
control: &ProductionControl<'_>,
) -> Result<PrivilegeSubjectScope<'_, S>, SQLError>
pub fn enter_privilege_subject_with_control( &mut self, subject: Produced<RoleReference>, control: &ProductionControl<'_>, ) -> Result<PrivilegeSubjectScope<'_, S>, SQLError>
Transfer an admitted authority reference with its original lease before publishing the override. Child scopes share that owner after this guard restores its parent.
Sourcepub fn enter_relation_lookup_mode(
&mut self,
relations_bound: bool,
) -> Result<RelationLookupScope<'_, S>, SQLError>
pub fn enter_relation_lookup_mode( &mut self, relations_bound: bool, ) -> Result<RelationLookupScope<'_, S>, SQLError>
Select the namespace semantics owned by one query plan and restore the parent plan’s mode on every exit path.
Sourcepub fn enter_query_plan_scope(
&mut self,
plan: &QueryPlan,
) -> Result<QueryPlanScope<'_, S>, SQLError>
pub fn enter_query_plan_scope( &mut self, plan: &QueryPlan, ) -> Result<QueryPlanScope<'_, S>, SQLError>
Enter the namespace and relation authority retained by one query, including rewritten inputs nested under a different statement owner.
pub fn enter_query_plan_scope_with_control( &mut self, plan: &QueryPlan, control: &ProductionControl<'_>, ) -> Result<QueryPlanScope<'_, S>, SQLError>
pub fn insert_rows(&mut self, name: String, rows: CteRows)
pub fn insert_deferred(&mut self, plan: RetainedCtePlan)
pub fn remove_deferred(&mut self, name: &str) -> Option<RetainedCtePlan>
Sourcepub fn deferred_for_scan(&self, name: &str) -> Option<RetainedCtePlan>
pub fn deferred_for_scan(&self, name: &str) -> Option<RetainedCtePlan>
Return a folded definition without consuming its lexical binding. A single syntactic reference can be built again by a recursive working-table iteration or a correlated consumer. Materialized producers replace the definition explicitly when installed.
pub fn materialized_for_scan(&self, reference: &str) -> Option<CteRows>
pub fn deferred_reference(&self, reference: &str) -> Option<&CtePlan>
pub fn deferred_ctes(&self) -> &BindingMap<RetainedCtePlan>
pub fn recursive_control_width(&self, name: &str) -> Option<usize>
pub fn set_recursive_control_width( &mut self, name: String, width: usize, ) -> Option<usize>
pub fn restore_recursive_control_width( &mut self, name: &str, previous: Option<usize>, )
pub fn remove_materialized(&mut self, name: &str) -> Option<CteRows>
Sourcepub fn enter_query_block(
&mut self,
block: &QueryBlockPlan,
) -> ScalarSubqueryScope<'_, S>
pub fn enter_query_block( &mut self, block: &QueryBlockPlan, ) -> ScalarSubqueryScope<'_, S>
Enter a query block’s scalar arena and the outer substitutions owned by its FROM expressions.
Sourcepub fn enter_query_block_with_control(
&mut self,
block: &QueryBlockPlan,
control: &ProductionControl<'_>,
) -> Result<ScalarSubqueryScope<'_, S>, SQLError>
pub fn enter_query_block_with_control( &mut self, block: &QueryBlockPlan, control: &ProductionControl<'_>, ) -> Result<ScalarSubqueryScope<'_, S>, SQLError>
Construct both private destinations before installing either, so admission failure leaves the complete parent namespace intact.
Sourcepub fn enter_scalar_subqueries(
&mut self,
subqueries: &[QueryPlan],
) -> ScalarSubqueryScope<'_, S>
pub fn enter_scalar_subqueries( &mut self, subqueries: &[QueryPlan], ) -> ScalarSubqueryScope<'_, S>
Bind the scalar-subquery arena owned by one query block. The guard restores the parent arena and correlated row binding on success, error, or panic so nested and lateral query execution cannot resolve a child slot in its parent.
pub fn enter_scalar_subqueries_with_control( &mut self, subqueries: &[QueryPlan], control: &ProductionControl<'_>, ) -> Result<ScalarSubqueryScope<'_, S>, SQLError>
pub fn enter_visible_ctes<'a, 'n>( &'a mut self, names: impl IntoIterator<Item = &'n str>, ) -> VisibleCteScope<'a, S>
Sourcepub fn enter_visible_ctes_with_control<'a, 'n>(
&'a mut self,
names: impl IntoIterator<Item = &'n str>,
control: &ProductionControl<'_>,
) -> Result<VisibleCteScope<'a, S>, SQLError>
pub fn enter_visible_ctes_with_control<'a, 'n>( &'a mut self, names: impl IntoIterator<Item = &'n str>, control: &ProductionControl<'_>, ) -> Result<VisibleCteScope<'a, S>, SQLError>
Build the complete name set before publication. The guard restores its exact previous owner without allocation on error or unwind.
Sourcepub fn is_visible_cte(&self, name: &str) -> bool
pub fn is_visible_cte(&self, name: &str) -> bool
Whether name resolves to a CTE in this scope: a name declared by an enclosing query’s WITH list, or one whose rows or deferred plan are bound in the scope, which is how a DML statement’s own WITH list reaches the query it drives.
Sourcepub fn contains_cte_name(&self, name: &str) -> bool
pub fn contains_cte_name(&self, name: &str) -> bool
Test an already decoded, unqualified identifier without applying SQL name parsing a second time.
pub fn returning_statement_snapshot_scope(&self) -> Self
pub fn returning_statement_snapshot_scope_with_control( &self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
pub fn reads_command_overlay(&self) -> bool
pub fn enable_command_progress_streaming(&mut self)
pub fn streams_command_progress(&self) -> bool
pub fn enable_backwards_scanning(&mut self)
pub fn scans_backwards(&self) -> bool
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn definition_scope(&self, reference: &str) -> Option<Self>
pub fn definition_scope(&self, reference: &str) -> Option<Self>
Prepare a definition in its original lexical bindings while retaining the invoking statement’s catalog, row locks, scalar arena and transaction controls.
pub fn definition_scope_with_control( &self, reference: &str, control: &ProductionControl<'_>, ) -> Result<Option<Self>, SQLError>
pub fn insert_deferred_with_control( &mut self, plan: RetainedCtePlan, control: &ProductionControl<'_>, ) -> Result<(), SQLError>
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn copy_with_control(
&self,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn copy_with_control( &self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Construct a complete independent lexical destination before exposing it. Plan, catalog, command and immutable row-lock metadata retain their existing owners; producer references remain weak, as in the original reader scopes.
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
pub fn materialized_for_scan_with_control( &self, reference: &str, control: &ProductionControl<'_>, ) -> Result<Option<CteRows>, SQLError>
pub fn deferred_reference_with_control( &self, reference: &str, control: &ProductionControl<'_>, ) -> Result<Option<&CtePlan>, SQLError>
pub fn is_visible_cte_with_control( &self, reference: &str, control: &ProductionControl<'_>, ) -> Result<bool, SQLError>
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn with_catalog_with_control(
catalog: CatalogReadView,
resolution: Produced<RelationNameResolution>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn with_catalog_with_control( catalog: CatalogReadView, resolution: Produced<RelationNameResolution>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Capture the current routine’s immutable statement inputs. The catalog already owns its generation; new namespace and execution-state payloads keep their own shared leases.
Sourcepub fn set_privilege_subject_with_control(
&mut self,
subject: Option<&RoleReference>,
control: &ProductionControl<'_>,
) -> Result<(), SQLError>
pub fn set_privilege_subject_with_control( &mut self, subject: Option<&RoleReference>, control: &ProductionControl<'_>, ) -> Result<(), SQLError>
Replace relation authority only after its complete private reference has been admitted. SQL-visible current_user and namespace stay in their original owner.
pub fn relation_name_resolution_with_control( &self, control: &ProductionControl<'_>, ) -> Result<Produced<RelationNameResolution>, SQLError>
Retain a preexisting transition materialization, admitting only its new lexical name and map node. Replacing the same name reuses its existing identity allocation.
Sourcepub fn insert_materialized_with_control(
&mut self,
name: &str,
rows: SharedSpill,
returns_rows: bool,
control: &ProductionControl<'_>,
) -> Result<(), SQLError>
pub fn insert_materialized_with_control( &mut self, name: &str, rows: SharedSpill, returns_rows: bool, control: &ProductionControl<'_>, ) -> Result<(), SQLError>
Publish materialized rows and their command visibility together after all new name storage is admitted.
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn enter_recursive_cte_with_control<'a, 'n>(
&'a mut self,
name: &'n str,
rows: SharedSpill,
width: Option<usize>,
control: &ProductionControl<'_>,
) -> Result<RecursiveCteScope<'a, 'n, S>, SQLError>
pub fn enter_recursive_cte_with_control<'a, 'n>( &'a mut self, name: &'n str, rows: SharedSpill, width: Option<usize>, control: &ProductionControl<'_>, ) -> Result<RecursiveCteScope<'a, 'n, S>, SQLError>
Complete both destinations before changing the scope. Saved nodes restore the parent on success, error and unwind without consuming more allowance.
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn activate_row_lock_recheck(&mut self, pins: Arc<RowLockRecheckPins>)
pub fn activate_row_lock_recheck(&mut self, pins: Arc<RowLockRecheckPins>)
Enter one tuple-local recheck execution: base scans of pinned lock targets emit only the candidate’s tuples and every nested LockRows is suppressed while lock identities keep flowing.
pub fn row_lock_recheck_active(&self) -> bool
Sourcepub fn set_row_lock_outer_row(&mut self, row: OwnedPhysicalRow)
pub fn set_row_lock_outer_row(&mut self, row: OwnedPhysicalRow)
Preserve the complete correlated outer row for a tuple-local locking recheck. The rebuilt inner query must receive the same scope overlay as its original lateral execution or its correlation predicate would see NULL after a lock wait and incorrectly discard the refreshed tuple.
pub fn row_lock_outer_row(&self) -> Option<&OwnedPhysicalRow>
pub fn clear_row_lock_outer_row(&mut self)
Sourcepub fn recheck_docs_for_scan(
&self,
qualifier: &str,
storage_name: &str,
) -> Option<Arc<Vec<RecheckDoc>>>
pub fn recheck_docs_for_scan( &self, qualifier: &str, storage_name: &str, ) -> Option<Arc<Vec<RecheckDoc>>>
Pinned tuples one base scan must emit during an active recheck.
Sourcepub fn recheck_source_row(&self, path: &[u8]) -> Option<RecheckSourceRow>
pub fn recheck_source_row(&self, path: &[u8]) -> Option<RecheckSourceRow>
Exact copy-row mark for one top-level FROM leaf in the active tuple recheck. Paths use 0/1 for left/right join descent and are scoped to the original LockRows source, so nested query aliases cannot collide.
Sourcepub fn enter_recheck_storage_pins(
&mut self,
qualifier: &str,
) -> RecheckStoragePinScope<'_, S>
pub fn enter_recheck_storage_pins( &mut self, qualifier: &str, ) -> RecheckStoragePinScope<'_, S>
Enter the build of one identity-source lock target’s subtree so every base scan of its storage inside the derived table or view is pinned. Pins already active from an enclosing target stay active: the target’s base scans may sit below further derived-table boundaries.
pub fn enter_lock_identity_emission( &mut self, enabled: bool, ) -> LockIdentityEmissionScope<'_, S>
pub fn enter_source_row_locks( &mut self, locks: Vec<ResolvedRowLock>, ) -> SourceRowLockScope<'_, S>
Sourcepub fn enter_source_row_locks_with_control(
&mut self,
locks: Produced<Vec<ResolvedRowLock>>,
control: &ProductionControl<'_>,
) -> Result<SourceRowLockScope<'_, S>, SQLError>
pub fn enter_source_row_locks_with_control( &mut self, locks: Produced<Vec<ResolvedRowLock>>, control: &ProductionControl<'_>, ) -> Result<SourceRowLockScope<'_, S>, SQLError>
Construct the complete shared owner before publishing a new binding; failure leaves the enclosing scope intact.
pub fn source_row_lock_for_view( &self, qualifier: &str, storage_name: &str, ) -> Option<SelectedRowLock>
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn enter_cte_bindings_with_control<'a, 'n>(
&'a mut self,
names: impl IntoIterator<Item = &'n str>,
control: &ProductionControl<'_>,
) -> Result<CteBindingScope<'a, S>, SQLError>
pub fn enter_cte_bindings_with_control<'a, 'n>( &'a mut self, names: impl IntoIterator<Item = &'n str>, control: &ProductionControl<'_>, ) -> Result<CteBindingScope<'a, S>, SQLError>
Restore only the selected names on every exit, preserving progress of unrelated materialized inputs.
Source§impl<S: Clone> CteScope<S>
impl<S: Clone> CteScope<S>
Sourcepub fn with_catalog(
catalog: CatalogReadView,
resolution: RelationNameResolution,
privilege_subject: Option<RoleReference>,
) -> Self
pub fn with_catalog( catalog: CatalogReadView, resolution: RelationNameResolution, privilege_subject: Option<RoleReference>, ) -> Self
Bind immutable statement metadata while keeping the snapshot payload owned by the caller.
pub fn set_reads_command_overlay(&mut self, enabled: bool)
pub fn set_relation_lookup_mode( &mut self, mode: RelationLookupMode, ) -> Result<(), SQLError>
pub fn cached_subquery(&self, slot: usize) -> Option<ScalarSubqueryCacheEntry>
pub fn cache_subquery(&self, slot: usize, entry: ScalarSubqueryCacheEntry)
pub fn new() -> Self
pub fn catalog_read_view(&self) -> Result<CatalogReadView, SQLError>
Sourcepub fn set_catalog_revision(&mut self, source: u64, revision: u64)
pub fn set_catalog_revision(&mut self, source: u64, revision: u64)
Record the caller’s source identity and invalidation revision when it captures the catalog, independently of the immutable binding view.
pub fn catalog_revision(&self) -> Option<(u64, u64)>
pub fn relation_name_resolution( &self, ) -> Result<RelationNameResolution, SQLError>
pub fn privilege_subject(&self) -> Result<&RoleReference, SQLError>
Sourcepub fn invoking_role(&self) -> Result<&RoleReference, SQLError>
pub fn invoking_role(&self) -> Result<&RoleReference, SQLError>
The statement’s invoking identity is independent of relation-owner overrides in enclosing views.
Trait Implementations§
Source§impl<S: Clone> CorrelationRelations for CteScope<S>
impl<S: Clone> CorrelationRelations for CteScope<S>
Source§impl<S: Clone> PrivilegeCteCatalog for CteScope<S>
impl<S: Clone> PrivilegeCteCatalog for CteScope<S>
fn is_visible_cte(&self, name: &str) -> bool
fn materialized_columns(&self, name: &str) -> Option<Vec<String>>
fn materialized_columns_with_control( &self, name: &str, control: &ProductionControl<'_>, ) -> Result<Option<Produced<Vec<String>>>, SQLError>
fn is_visible_cte_with_control( &self, name: &str, control: &ProductionControl<'_>, ) -> Result<bool, SQLError>
fn deferred_reference_with_control( &self, name: &str, control: &ProductionControl<'_>, ) -> Result<Option<&CtePlan>, SQLError>
fn deferred_reference(&self, name: &str) -> Option<&CtePlan>
fn privilege_subject(&self) -> Result<&RoleReference, SQLError>
Source§impl<S: Clone> ReturningScope for CteScope<S>
impl<S: Clone> ReturningScope for CteScope<S>
fn binding_snapshot(&self) -> Result<BindingSnapshot, SQLError>
Source§impl<S: Clone> StatementBindingScope for CteScope<S>
impl<S: Clone> StatementBindingScope for CteScope<S>
fn binding_context_with_control( &self, control: &ProductionControl<'_>, ) -> Result<ControlledBindingContext<'_>, SQLError>
fn binding_context(&self) -> Result<BindingContext<'_>, SQLError>
Auto Trait Implementations§
impl<S = ()> !RefUnwindSafe for CteScope<S>
impl<S = ()> !UnwindSafe for CteScope<S>
impl<S> Freeze for CteScope<S>
impl<S> Send for CteScope<S>
impl<S> Sync for CteScope<S>
impl<S> Unpin for CteScope<S>
impl<S> UnsafeUnpin for CteScope<S>
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more