pub struct Expr {
pub kind: ExprKind,
pub ty: u32,
pub typmod: i32,
pub location: Option<usize>,
}Expand description
An expression with its type and its typmod. A typmod of -1 means that the expression has no typmod.
Fields§
§kind: ExprKind§ty: u32The OID of the type of the value.
typmod: i32§location: Option<usize>The byte offset in the query text of the place that the expression starts, for the position of an error, or None.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn constant(
value: Value,
ty: u32,
typmod: i32,
location: Option<usize>,
) -> Expr
pub fn constant( value: Value, ty: u32, typmod: i32, location: Option<usize>, ) -> Expr
A constant.
Sourcepub fn as_const(&self) -> Option<&Value>
pub fn as_const(&self) -> Option<&Value>
The value of a constant, or None for any other expression.
Sourcepub fn own_cost(&self) -> f64
pub fn own_cost(&self) -> f64
The cost of the calls of functions and operators in the node of this expression, without its children, in units of cpu_operator_cost, as cost_qual_eval_walker adds it. A call, an operator, NULLIF and IS DISTINCT FROM cost the procost of their function, as add_function_cost adds it.
Sourcepub fn leaky(&self) -> bool
pub fn leaky(&self) -> bool
contain_leaked_vars: true when the expression can give information about a column of the query other than through its result, as a call of a function that is not leakproof with a column in its arguments does. An expression of a kind that the check does not know is leaky.
Sourcepub fn children(&self) -> Vec<&Expr>
pub fn children(&self) -> Vec<&Expr>
The expressions that this expression has as its arguments.
Sourcepub fn same(&self, other: &Expr) -> bool
pub fn same(&self, other: &Expr) -> bool
equal of PostgreSQL: true when the two expressions are the same apart from their locations.
Sourcepub fn find<'a, T>(
&'a self,
depth: usize,
f: &mut impl FnMut(&'a Expr, usize) -> Option<T>,
) -> Option<T>
pub fn find<'a, T>( &'a self, depth: usize, f: &mut impl FnMut(&'a Expr, usize) -> Option<T>, ) -> Option<T>
Calls f for the expression and for each expression in it, also in its subqueries, with the number of subqueries between the expression and this expression. The search stops at the first Some that f gives.
Sourcepub fn first_var(&self) -> Option<&Expr>
pub fn first_var(&self) -> Option<&Expr>
The first column of the query of the expression that the expression reads, also in a subquery, as locate_var_of_level finds it with level 0.
Sourcepub fn raise(&mut self, levels: usize)
pub fn raise(&mut self, levels: usize)
IncrementVarSublevelsUp: the columns of the outer queries in the expression, also in its subqueries, are levels more levels up. A column of a query in the expression does not change.
Sourcepub fn each_mut(
&mut self,
depth: usize,
f: &mut impl FnMut(&mut Expr, usize) -> bool,
)
pub fn each_mut( &mut self, depth: usize, f: &mut impl FnMut(&mut Expr, usize) -> bool, )
expression_tree_mutator: calls f for the expression and for each expression in it, also in its subqueries, with the number of subqueries between the expression and this expression. f sees an expression before the expressions in it, and when f gives true, the walk does not go into the expression, as for an expression that f put in its place.
Sourcepub fn map_attnos(&mut self, map: &[i16])
pub fn map_attnos(&mut self, map: &[i16])
map_variable_attnos for an expression on one relation, such as a check constraint or an index expression: each column gets the number that map gives for it, the number in a partition for each column of its parent table. A system column and a whole-row column keep their numbers.
Sourcepub fn lower(&mut self, levels: usize)
pub fn lower(&mut self, levels: usize)
IncrementVarSublevelsUp with a negative delta: each column of a query outside the expression comes levels levels down, as the planner moves an aggregate of an outer query to that query. A column of a level that is less than levels levels up does not change.
Sourcepub fn first_agg(&self) -> Option<&Expr>
pub fn first_agg(&self) -> Option<&Expr>
contain_aggs_of_level and locate_agg_of_level: the first aggregate call or call of GROUPING in the expression.
Sourcepub fn first_window(&self) -> Option<&Expr>
pub fn first_window(&self) -> Option<&Expr>
contain_windowfuncs and locate_windowfunc: the first call of a window function in the expression, outside its subqueries.
Sourcepub fn first_set_call(&self) -> Option<&Expr>
pub fn first_set_call(&self) -> Option<&Expr>
expression_returns_set and exprLocation of the first call: the first call of a function that gives a set in the expression, outside its subqueries.
Sourcepub fn strip_implicit(&self) -> &Expr
pub fn strip_implicit(&self) -> &Expr
strip_implicit_coercions: the expression without the casts that the analyzer added.