pub enum TableFactor {
    Table {
        name: ObjectName,
        alias: Option<TableAlias>,
        args: Option<Vec<FunctionArg>>,
        with_hints: Vec<Expr>,
    },
    Derived {
        lateral: bool,
        subquery: Box<Query>,
        alias: Option<TableAlias>,
    },
    TableFunction {
        expr: Expr,
        alias: Option<TableAlias>,
    },
    UNNEST {
        alias: Option<TableAlias>,
        array_expr: Box<Expr>,
        with_offset: bool,
        with_offset_alias: Option<Located<Ident>>,
    },
    NestedJoin {
        table_with_joins: Box<TableWithJoins>,
        alias: Option<TableAlias>,
    },
}
Expand description

A table name or a parenthesized subquery with an optional alias

Variants§

§

Table

Fields

§args: Option<Vec<FunctionArg>>

Arguments of a table-valued function, as supported by Postgres and MSSQL. Note that deprecated MSSQL FROM foo (NOLOCK) syntax will also be parsed as args.

This field’s value is Some(v), where v is a (possibly empty) vector of arguments, in the case of a table-valued function call, whereas it’s None in the case of a regular table name.

§with_hints: Vec<Expr>

MSSQL-specific WITH (...) hints such as NOLOCK.

§

Derived

Fields

§lateral: bool
§subquery: Box<Query>
§

TableFunction

Fields

§expr: Expr

TABLE(<expr>)[ AS <alias> ]

§

UNNEST

Fields

§array_expr: Box<Expr>
§with_offset: bool
§with_offset_alias: Option<Located<Ident>>
SELECT * FROM UNNEST ([10,20,30]) as numbers WITH OFFSET;
+---------+--------+
| numbers | offset |
+---------+--------+
| 10      | 0      |
| 20      | 1      |
| 30      | 2      |
+---------+--------+
§

NestedJoin

Fields

§table_with_joins: Box<TableWithJoins>

Represents a parenthesized table factor. The SQL spec only allows a join expression ((foo <JOIN> bar [ <JOIN> baz ... ])) to be nested, possibly several times.

The parser may also accept non-standard nesting of bare tables for some dialects, but the information about such nesting is stripped from AST.

Trait Implementations§

source§

impl Clone for TableFactor

source§

fn clone(&self) -> TableFactor

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for TableFactor

source§

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

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

impl<'de> Deserialize<'de> for TableFactor

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for TableFactor

source§

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

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

impl Hash for TableFactor

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for TableFactor

source§

fn cmp(&self, other: &TableFactor) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<TableFactor> for TableFactor

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<TableFactor> for TableFactor

source§

fn partial_cmp(&self, other: &TableFactor) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for TableFactor

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Visit for TableFactor

source§

fn visit<V: Visitor>(&self, visitor: &mut V) -> ControlFlow<V::Break>

source§

impl VisitMut for TableFactor

source§

fn visit<V: VisitorMut>(&mut self, visitor: &mut V) -> ControlFlow<V::Break>

source§

impl Eq for TableFactor

source§

impl StructuralEq for TableFactor

source§

impl StructuralPartialEq for TableFactor

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,