Skip to main content

Module expr

Module expr 

Source
Expand description

Scalar expression evaluator: turns an Expr into a Value under a row context (column -> value) and a parameter binding.

Structs§

CompiledLikePattern
A LIKE/ILIKE pattern compiled once for repeated evaluation.
EvalContext

Enums§

IntegerWidth

Constants§

NAMED_ARG_FUNCTION
Marker function the compiler wraps name => value call arguments in (NamedArgExpr has no dedicated AST node).
TO_HEX_INT4_FUNCTION
Physical scalar built-ins selected after PostgreSQL overload resolution has preserved the declared integer width.
TO_HEX_INT8_FUNCTION

Traits§

EngineHook
Engine-side hook that scalar function evaluation calls for stateful sequence and user-defined functions. Query-valued expressions are not accepted here: lowering assigns them physical query-plan slots executed by uqa-execution::ScalarSubqueryRunner.
RowLookup
Read-only row interface used by the expression evaluator. Most callers use a materialised ResultRow, while hot execution paths can expose a projected value slice without rebuilding a string-keyed map for every row.

Functions§

array_dimensions
Return every dimension of a rectangular array value.
array_value_to_string
builtin_scalar_function_strictness
Return the PostgreSQL 18 strictness contract for a built-in scalar call when its implemented overload is known.
cast_value
Cast a value to the named SQL type, mirroring CAST(expr AS ty). Types outside the engine’s coercion surface return SQLError::Unsupported.
cast_value_from
Cast a value while preserving an explicitly declared source type when the runtime carrier erases it. PostgreSQL 18 integer-to-bytea/oid casts and xid cast rejection require the source’s declared identity.
eval
Evaluate a value-producing expression. Function calls are not dispatched here; the compiler routes them through the function registry instead. Calling eval on a Func expr returns Unsupported so latent function-in-projection bugs surface loudly.
eval_binary_values
Apply a binary SQL operator to values that have already been evaluated. Execution engines use this when a hot path compiles expression traversal ahead of time but must retain the evaluator’s exact comparison, numeric promotion, NULL, overflow, and division-by-zero semantics.
eval_binary_values_with_integer_width
Evaluate an operator while retaining the integer type selected by SQL operator resolution. The dynamic Value carrier stores all integers as i64, so expression plans pass this width alongside the operands.
eval_comparison_truth
Compare two values without allocating an intermediate Value::Bool.
eval_function_call
Execute a scalar function after its argument expressions have already been evaluated.
evaluate_call_args
Evaluate a call’s argument list, unwrapping name => value markers into (Some(name), value) pairs.
integer_width_for_literal
integer_width_for_type
negate_value
Apply PostgreSQL prefix - while retaining the operand’s declared type.
parse_pg_array_literal
Parse a PostgreSQL array literal ({1,2,3}, {"a b",NULL}, {{1,2},{3,4}}) into nested lists of string/NULL values; the caller casts elements.
quote_ident
quote_ident: double-quote unless the identifier is a safe lower-case name that is not a keyword.
truthy
NULL is falsy; otherwise truthy iff the value coerces to a non-zero boolean / number / non-empty string.
unknown_function_error
function name(arg types) does not exist - the error PostgreSQL raises when call resolution fails (SQLSTATE 42883).
value_to_json_text
Render an engine value as PostgreSQL JSON input text without losing the lexical representation of values already typed as json or jsonb.
value_to_string
value_to_tensor
Coerce a Value into a tensor: an array of homogeneous numeric vectors. Used by TENSOR(N) columns to store chunk embeddings for one row while still indexing each vector element.
value_to_vector
Coerce a Value into a Vec<f32> if it is a homogeneous numeric list (used to read vector literals from ARRAY[...] or $N Vector params).
value_type_name
PostgreSQL-style type name used in function-resolution errors.