Skip to main content

TableRef

Struct TableRef 

Source
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>,
    pub trace: Option<String>,
    pub trace_reverse: bool,
    pub traverse: Option<String>,
}

Fields§

§name: String

The 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: bool

LATERAL (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.

§trace: Option<String>

FROM orders TRACE caused_by [REVERSE] — the causal chain that produced each row, walked over caused_by edges.

The last two NQL verbs to arrive here, and the reason they were last is that they are the two that CHANGE THE ROW SET rather than filter it: a trace replaces each row with its chain. That is also why they belong on the table rather than in the WHERE — the transform happens as the relation is produced, and everything SQL does (join, subquery, set operation, aggregate) then composes around the traced relation.

Unreserved, by the same discipline as SEARCH and VALID: TRACE starts a clause only when an identifier follows it, so FROM orders trace still aliases the relation trace.

§trace_reverse: bool

REVERSE on the trace — walk effects instead of causes.

§traverse: Option<String>

FROM orders TRAVERSE ships_to — one hop along a named relation, replacing each row with its neighbours.

Implementations§

Source§

impl TableRef

Source

pub fn named(name: impl Into<String>, alias: Option<String>) -> Self

A plain named relation.

Source

pub fn binding(&self) -> String

How this table’s columns are addressed: the alias when given, else the table’s own bare name, which is what SQL says.

Trait Implementations§

Source§

impl Clone for TableRef

Source§

fn clone(&self) -> TableRef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TableRef

Source§

fn eq(&self, other: &TableRef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TableRef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more