pub struct TableRef {
pub name: String,
pub alias: Option<String>,
pub sub: Option<Box<Select>>,
pub args: Option<Vec<Expr>>,
pub col_aliases: Vec<String>,
pub lateral: bool,
pub as_of: Option<u64>,
pub valid_as_of: Option<String>,
pub search: Option<String>,
}Fields§
§name: StringThe table name as written, minus quoting. A pg_catalog. qualifier is
preserved here and resolved by the caller, because information_schema
table names collide with plausible user collection names.
For a derived table this is the literal (subquery), and for a table
function it is the function’s bare name — both only ever shown in a
plan, never resolved as a relation.
alias: Option<String>§sub: Option<Box<Select>>FROM (SELECT ...) AS t — the relation is the subquery’s output.
psql’s \dd is one seven-arm UNION ALL wrapped exactly this way.
args: Option<Vec<Expr>>FROM generate_series(0, n) s / FROM unnest(arr) AS t(x) — a table
function with its arguments. Evaluated in the enclosing row’s scope,
because psql writes unnest(evttags) over the OUTER row’s column.
col_aliases: Vec<String>AS t(x, y) — column aliases for a derived table or table function.
lateral: boolLATERAL (SELECT ...) — the derived table may read the FROM items
before it, so it is re-evaluated once per row of those. psql’s \dP+
sizes each partitioned table this way.
as_of: Option<u64>FROM orders AS OF SYSTEM TIME 42 — read this relation at that NEDB
sequence instead of at the tip.
It hangs on the TABLE rather than on the query for two reasons. It is
where PostgreSQL’s own grammar would take it (relation_expr, the
production table_ref is built from), and it is the only placement that
can express the query worth having: one relation AS OF a past sequence
joined against another at the tip, which is how you ask what changed.
A sequence, never a wall-clock time. NEDB’s history is sequence-addressed and never garbage-collected, so a seq is exact where a timestamp would be approximate — the same refusal the translator has always made, made in the same words.
valid_as_of: Option<String>FROM orders VALID AS OF '2026-01-01' — bi-temporal: what was believed
TRUE as of that date, as distinct from what the log SAID at a sequence.
A date string, because application-time validity is a wall-clock notion
where system time is a sequence.
search: Option<String>FROM orders SEARCH 'acme' — full-text over the document’s fields.
Per-table like the others, which is the point: one relation searched and another joined to it is a sentence SQL can now say.
Implementations§
Trait Implementations§
impl StructuralPartialEq for TableRef
Auto Trait Implementations§
impl Freeze for TableRef
impl RefUnwindSafe for TableRef
impl Send for TableRef
impl Sync for TableRef
impl Unpin for TableRef
impl UnsafeUnpin for TableRef
impl UnwindSafe for TableRef
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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