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.
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.
NullIf
NullIfExpr: null when the function of the = operator gives true, or else the first argument.
Distinct
DistinctExpr: IS DISTINCT FROM, or IS NOT DISTINCT FROM when not is true, with the function of the = operator.
ScalarArrayOp
ScalarArrayOpExpr: x op ANY (array) when any is true, or x op ALL (array).
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.
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(Box<SubLink>)
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.