Skip to main content

ValueExpr

Type Alias ValueExpr 

Source
pub type ValueExpr = Expr;
Expand description

Expr restricted to value-producing forms used by INSERT rows.

Aliased Type§

pub enum ValueExpr {
Show 24 variants Star, QualifiedStar(String), Default, Column(String), QualifiedColumn { qualifier: String, column: String, }, Literal(Value), Param(usize), Func { name: String, binding: Option<FunctionBinding>, args: Vec<Expr>, distinct: bool, order_by: Vec<OrderBy>, filter: Option<Box<Expr>>, }, Array(Vec<Expr>), Row(Vec<Expr>), Binary { op: BinaryOp, lhs: Box<Expr>, rhs: Box<Expr>, }, UnaryMinus(Box<Expr>), Not(Box<Expr>), And(Vec<Expr>), Or(Vec<Expr>), IsNull { expr: Box<Expr>, negated: bool, }, Between { expr: Box<Expr>, low: Box<Expr>, high: Box<Expr>, }, InList { expr: Box<Expr>, list: Vec<Expr>, negated: bool, }, WindowCall { name: String, args: Vec<Expr>, spec: WindowSpec, }, Case { base: Option<Box<Expr>>, when: Vec<(Expr, Expr)>, else_branch: Option<Box<Expr>>, }, Cast { expr: Box<Expr>, ty: String, }, ScalarSubquery(Box<SelectStmt>), Exists { body: Box<SelectStmt>, negated: bool, }, InSubquery { expr: Box<Expr>, body: Box<SelectStmt>, negated: bool, },
}

Variants§

§

Star

§

QualifiedStar(String)

Relation-qualified wildcard projection (table.* or alias.*).

§

Default

DEFAULT in an INSERT/UPDATE assignment. This is a mutation marker, not a scalar value, and must be resolved against the target column before expression evaluation.

§

Column(String)

Unqualified column reference (col).

§

QualifiedColumn

Qualified column reference (table.col or alias.col).

Fields

§qualifier: String
§column: String
§

Literal(Value)

§

Param(usize)

A positional bind parameter ($1, $2, …).

§

Func

text_match(...), knn_match(...), etc. - dispatched through the function registry.

Fields

§name: String
§args: Vec<Expr>
§distinct: bool

func(DISTINCT expr) - only meaningful for aggregate functions. Mirrors PostgreSQL’s agg_distinct.

§order_by: Vec<OrderBy>

func(expr ORDER BY ...) - only meaningful for ordered aggregates (STRING_AGG, ARRAY_AGG, PERCENTILE_*).

§filter: Option<Box<Expr>>

func(...) FILTER (WHERE expr) - aggregate-level row filter.

§

Array(Vec<Expr>)

ARRAY[1.0, 2.0, ...] literal - currently restricted to numeric elements (vectors).

§

Row(Vec<Expr>)

Anonymous SQL row constructor (ROW(...) or (a, b)).

§

Binary

lhs op rhs - comparison or arithmetic.

Fields

§lhs: Box<Expr>
§rhs: Box<Expr>
§

UnaryMinus(Box<Expr>)

PostgreSQL prefix -, kept distinct from binary subtraction so the operand’s declared numeric width and overflow behavior survive lowering.

§

Not(Box<Expr>)

NOT expr.

§

And(Vec<Expr>)

cond_1 AND cond_2 AND ... (n-ary).

§

Or(Vec<Expr>)

cond_1 OR cond_2 OR ... (n-ary).

§

IsNull

expr IS NULL / expr IS NOT NULL.

Fields

§expr: Box<Expr>
§negated: bool
§

Between

expr BETWEEN low AND high.

Fields

§expr: Box<Expr>
§low: Box<Expr>
§high: Box<Expr>
§

InList

expr IN (a, b, c) literal list.

Fields

§expr: Box<Expr>
§list: Vec<Expr>
§negated: bool
§

WindowCall

func(args) OVER (PARTITION BY ... ORDER BY ...).

Fields

§name: String
§args: Vec<Expr>
§

Case

CASE [base] WHEN cond THEN result ... [ELSE default] END. base lifts simple-form CASE expr WHEN val THEN ... into an optional comparison anchor; searched-form CASE WHEN cond ... leaves it None.

Fields

§base: Option<Box<Expr>>
§when: Vec<(Expr, Expr)>
§else_branch: Option<Box<Expr>>
§

Cast

CAST(expr AS type). The type name is preserved verbatim so the evaluator can apply the correct coercion.

Fields

§expr: Box<Expr>
§

ScalarSubquery(Box<SelectStmt>)

(SELECT ...) scalar subquery: yields a single row / single column value at evaluation time.

§

Exists

EXISTS (SELECT ...) – truthy when the body produces at least one row.

Fields

§negated: bool
§

InSubquery

expr [NOT] IN (SELECT ...) set membership against a subquery. Evaluator runs the body once per top-level expression and tests membership.

Fields

§expr: Box<Expr>
§negated: bool