Skip to main content

ExprKind

Enum ExprKind 

Source
pub enum ExprKind {
Show 41 variants Const(Value), Param(usize), Func(Func), NamedArg(Box<NamedArg>), Relabel(Box<Expr>, CastForm), CoerceViaIo(Box<Expr>, CastForm), ArrayCoerce { arg: Box<Expr>, element: Box<Expr>, form: CastForm, }, CoerceToDomain(Box<Expr>, CastForm), DomainValue, Subscript(Box<Subscript>), Bool(BoolOp, Vec<Expr>), NullTest(Box<Expr>, bool), BooleanTest(Box<Expr>, BoolTest), Case(Case), CaseTest, Coalesce(Vec<Expr>), MinMax { greatest: bool, less: u32, args: Vec<Expr>, }, NullIf { equal: u32, args: Vec<Expr>, }, Distinct { equal: u32, not: bool, args: Vec<Expr>, }, ScalarArrayOp { func: u32, any: bool, args: Vec<Expr>, }, Row(Vec<Expr>, CastForm), JoinRow(Box<JoinRow>), RowCompare(Box<RowCompare>), Array { element: u32, multidims: bool, elements: Vec<Expr>, }, SqlValue(SqlValue), Var(Var), FieldSelect(Box<Expr>, usize), FieldStore(Box<FieldStore>), Agg(Box<Aggref>), Window(Box<WindowFunc>), Grouping(Box<GroupingFunc>), PlaceHolder(Box<PlaceHolder>), SubLink(Box<SubLink>), SubColumn(usize), JsonValue(Box<JsonValue>), JsonCtor(Box<JsonCtor>), IsJson(Box<IsJson>), JsonExpr(Box<JsonExpr>), JsonTable(Box<JsonTable>), Xml(Box<XmlExpr>), CurrentOf(Box<CurrentOf>),
}
Expand description

The kinds of expression.

Variants§

§

Const(Value)

Const: a value. A string literal that has no type yet has the type unknown and a Text value.

§

Param(usize)

Param: the parameter $n, from 1.

§

Func(Func)

FuncExpr and OpExpr: a call of the function with this pg_proc OID.

§

NamedArg(Box<NamedArg>)

NamedArgExpr: an argument of a call that the call gives by its name, as name => value. The planner puts the arguments in the order of the function.

§

Relabel(Box<Expr>, CastForm)

RelabelType: the value of the argument with another type that has the same binary form.

§

CoerceViaIo(Box<Expr>, CastForm)

CoerceViaIO: the output function of the type of the argument, then the input function of the type of the expression.

§

ArrayCoerce

ArrayCoerceExpr: a cast of each element of an array. element casts ExprKind::CaseTest, which is the value of one element.

Fields

§arg: Box<Expr>
§element: Box<Expr>
§

CoerceToDomain(Box<Expr>, CastForm)

CoerceToDomain: the value of the argument as a value of the domain of the expression, after the domain checks its constraints. The argument has the base type of the domain.

§

DomainValue

CoerceToDomainValue: VALUE in a check constraint of a domain, the value that the domain checks.

§

Subscript(Box<Subscript>)

SubscriptingRef: an element or a slice of an array.

§

Bool(BoolOp, Vec<Expr>)

BoolExpr: AND, OR and NOT.

§

NullTest(Box<Expr>, bool)

NullTest: IS NULL when the flag is true, IS NOT NULL when it is false.

§

BooleanTest(Box<Expr>, BoolTest)

BooleanTest: IS TRUE, IS NOT UNKNOWN and the others.

§

Case(Case)

CaseExpr. With an argument, each condition compares ExprKind::CaseTest to a value.

§

CaseTest

CaseTestExpr: the value of the argument of the CASE that holds this expression.

§

Coalesce(Vec<Expr>)

CoalesceExpr: the first argument that is not null.

§

MinMax

MinMaxExpr: GREATEST or LEAST, with the function of the < operator of the type.

Fields

§greatest: bool
§less: u32
§args: Vec<Expr>
§

NullIf

NullIfExpr: null when the function of the = operator gives true, or else the first argument.

Fields

§equal: u32
§args: Vec<Expr>
§

Distinct

DistinctExpr: IS DISTINCT FROM, or IS NOT DISTINCT FROM when not is true, with the function of the = operator.

Fields

§equal: u32
§not: bool
§args: Vec<Expr>
§

ScalarArrayOp

ScalarArrayOpExpr: x op ANY (array) when any is true, or x op ALL (array).

Fields

§func: u32
§any: bool
§args: Vec<Expr>
§

Row(Vec<Expr>, CastForm)

RowExpr: ROW(...), a value of record with a field for each argument. The form is explicit for a cast of a row to a composite type, as row_format.

§

JoinRow(Box<JoinRow>)

The whole row of a join, as the Var with the attribute number 0 of a join, which the planner of PostgreSQL makes a RowExpr with the names of the columns. A join with no relation of its own gives the columns of the join as the fields.

§

RowCompare(Box<RowCompare>)

RowCompareExpr: (a, b) < (c, d) and the other comparisons of two rows with an ordering operator.

§

Array

ArrayExpr: ARRAY[...]. The elements of a multidimensional array are arrays.

Fields

§element: u32
§multidims: bool
§elements: Vec<Expr>
§

SqlValue(SqlValue)

SQLValueFunction, such as CURRENT_USER and CURRENT_TIMESTAMP(3).

§

Var(Var)

Var: a column of a relation of FROM, or with the attribute number 0 the whole row of the relation, as a value of its row type.

§

FieldSelect(Box<Expr>, usize)

FieldSelect: the field with this index, from 0, of a row value.

§

FieldStore(Box<FieldStore>)

FieldStore: the row value of the argument with new values in some of its fields. The result is the row value.

§

Agg(Box<Aggref>)

Aggref: a call of an aggregate function, which reads all the rows of a group.

§

Window(Box<WindowFunc>)

WindowFunc: a call of a window function, which reads the rows of its window.

§

Grouping(Box<GroupingFunc>)

GroupingFunc: a call of GROUPING, of type integer.

§

PlaceHolder(Box<PlaceHolder>)

PlaceHolderVar: an expression of a subquery that the planner merged below the side of an outer join that can give nulls. Only the planner makes it.

SubLink: a subquery in an expression.

§

SubColumn(usize)

Param of the kind PARAM_SUBLINK: the value of the column with this index, from 0, of a row of the subquery, in the test of ANY or ALL.

§

JsonValue(Box<JsonValue>)

JsonValueExpr: an input of a SQL/JSON function with its FORMAT clause, as the value of the formatted expression.

§

JsonCtor(Box<JsonCtor>)

JsonConstructorExpr: JSON_OBJECT, JSON_ARRAY, JSON, JSON_SCALAR or JSON_SERIALIZE.

§

IsJson(Box<IsJson>)

JsonIsPredicate: IS JSON, of type boolean.

§

JsonExpr(Box<JsonExpr>)

JsonExpr: JSON_EXISTS, JSON_QUERY or JSON_VALUE.

§

JsonTable(Box<JsonTable>)

TableFunc of the kind TFT_JSON_TABLE: the call of JSON_TABLE in FROM, of type record.

§

Xml(Box<XmlExpr>)

XmlExpr: XMLELEMENT, XMLFOREST, XMLCONCAT, XMLPARSE, XMLPI, XMLROOT, XMLSERIALIZE or IS DOCUMENT.

§

CurrentOf(Box<CurrentOf>)

CurrentOfExpr: WHERE CURRENT OF, of type boolean.

Trait Implementations§

Source§

impl Clone for ExprKind

Source§

fn clone(&self) -> Self

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 ExprKind

Source§

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

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

impl PartialEq for ExprKind

Source§

fn eq(&self, other: &Self) -> 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 ExprKind

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, 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> 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.