pub enum TableVersion<X: Extension = NoExt> {
ForSystemTimeAsOf {
point: Box<Expr<X>>,
meta: Meta,
},
ForSystemTimeFromTo {
start: Box<Expr<X>>,
end: Box<Expr<X>>,
meta: Meta,
},
ForSystemTimeBetween {
start: Box<Expr<X>>,
end: Box<Expr<X>>,
meta: Meta,
},
ForSystemTimeContainedIn {
start: Box<Expr<X>>,
end: Box<Expr<X>>,
meta: Meta,
},
ForSystemTimeAll {
meta: Meta,
},
VersionAsOf {
version: Box<Expr<X>>,
meta: Meta,
},
TimestampAsOf {
point: Box<Expr<X>>,
meta: Meta,
},
}Expand description
A table version / time-travel modifier on a base-table factor, written between the
table name and its correlation alias (FROM t FOR SYSTEM_TIME AS OF <ts> AS e) — the
version slot of a TableFactor::Table.
Available to a planner as a typed value, so a time-travel query is recognized without
string-inspecting the source. This reshapes sqlparser-rs’s two-arm TableVersion
(ForSystemTimeAsOf(Expr) / Function(Expr)), which collapses MSSQL’s five distinct
FOR SYSTEM_TIME temporal forms into one: each spelling is its own variant here, so a
planner sees the endpoints (FROM … TO, BETWEEN … AND, CONTAINED IN) directly and
the renderer round-trips the written form. The Snowflake AT/BEFORE function form
(sqlparser-rs’s Function arm) is out of scope — no shipped preset carries it — and is
a deferral, not modelled here.
Gated by
TableExpressionSyntax::table_version: on for
BigQuery (its FOR SYSTEM_TIME AS OF), MSSQL (the five temporal-table forms),
Databricks/Delta (VERSION/TIMESTAMP AS OF), and Lenient; off elsewhere, where the
clause keyword is left unconsumed so a query-level FOR (locking, FOR XML) still
parses.
Variants§
ForSystemTimeAsOf
FOR SYSTEM_TIME AS OF <expr> — the point-in-time snapshot shared by BigQuery
(its only spelling) and MSSQL temporal tables.
Fields
ForSystemTimeFromTo
MSSQL FOR SYSTEM_TIME FROM <start> TO <end> — the half-open [start, end)
row-version range (the endpoint end is excluded, unlike BETWEEN … AND).
Fields
ForSystemTimeBetween
MSSQL FOR SYSTEM_TIME BETWEEN <start> AND <end> — the closed-on-both-ends
[start, end] row-version range (end included, unlike FROM … TO).
Fields
ForSystemTimeContainedIn
MSSQL FOR SYSTEM_TIME CONTAINED IN (<start>, <end>) — rows whose validity
period is fully contained within [start, end].
Fields
ForSystemTimeAll
MSSQL FOR SYSTEM_TIME ALL — every row version, historical and current; the one
endpoint-free temporal form.
VersionAsOf
Delta/Databricks VERSION AS OF <expr> — a snapshot selected by table version
number.
Fields
TimestampAsOf
Delta/Databricks TIMESTAMP AS OF <expr> — a snapshot selected by timestamp.
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for TableVersion<X>
impl<X: Clone + Extension> Clone for TableVersion<X>
Source§fn clone(&self) -> TableVersion<X>
fn clone(&self) -> TableVersion<X>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, X> Deserialize<'de> for TableVersion<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for TableVersion<X>where
X: Deserialize<'de> + Extension,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<X: Eq + Extension> Eq for TableVersion<X>
Source§impl<X: Extension + Render> Render for TableVersion<X>
impl<X: Extension + Render> Render for TableVersion<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl<X> Serialize for TableVersion<X>
impl<X> Serialize for TableVersion<X>
Source§impl<X: Extension> Spanned for TableVersion<X>
impl<X: Extension> Spanned for TableVersion<X>
impl<X: PartialEq + Extension> StructuralPartialEq for TableVersion<X>
Auto Trait Implementations§
impl<X> Freeze for TableVersion<X>
impl<X> RefUnwindSafe for TableVersion<X>where
X: RefUnwindSafe,
impl<X> Send for TableVersion<X>where
X: Send,
impl<X> Sync for TableVersion<X>where
X: Sync,
impl<X> Unpin for TableVersion<X>
impl<X> UnsafeUnpin for TableVersion<X>
impl<X> UnwindSafe for TableVersion<X>where
X: UnwindSafe,
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.