#[non_exhaustive]pub enum Value {
Show 21 variants
SmallInt(i16),
Int(i32),
BigInt(i64),
Float(f64),
Text(String),
Bool(bool),
Vector(Vec<f32>),
Sq8Vector(Sq8Vector),
HalfVector(HalfVector),
Numeric {
scaled: i128,
scale: u8,
},
Date(i32),
Timestamp(i64),
Interval {
months: i32,
micros: i64,
},
Json(String),
Bytes(Vec<u8>),
TextArray(Vec<Option<String>>),
IntArray(Vec<Option<i32>>),
BigIntArray(Vec<Option<i64>>),
TsVector(Vec<TsLexeme>),
TsQuery(TsQueryAst),
Null,
}Expand description
A row-cell value, including SQL NULL. Float uses f64; NaN compares
non-equal to itself (PG behaviour) — PartialEq is derived so callers
must opt into NaN-aware comparison if they need stronger guarantees.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SmallInt(i16)
Int(i32)
BigInt(i64)
Float(f64)
Text(String)
Bool(bool)
Vector(Vec<f32>)
Sq8Vector(Sq8Vector)
v6.0.1: 8-bit scalar-quantised vector cell. Lives in
columns declared VECTOR(N) USING SQ8. Layout per cell:
Sq8Vector { min: f32, max: f32, bytes: Vec<u8> } —
4× compression vs Vector(Vec<f32>). The wire layer
dequantises to f32 on SELECT; INSERT path quantises
incoming Vector(Vec<f32>) cells into this variant.
HalfVector(HalfVector)
v6.0.3: IEEE-754 binary16 vector cell. Lives in columns
declared VECTOR(N) USING HALF. Stores raw u16 LE bits
(2× compression vs Vector(Vec<f32>)). Wire / display
paths dequantise to f32 bit-exactly; INSERT path converts
incoming f32 vectors at the engine boundary.
Numeric
Exact fixed-point decimal. scaled holds the value as
actual * 10^scale so the storage type is always integral —
arithmetic never falls back to floating-point.
Date(i32)
Days since the Unix epoch (1970-01-01). Negative for earlier dates.
Timestamp(i64)
Microseconds since the Unix epoch (1970-01-01T00:00:00Z).
Interval
Calendar span: months (variable-length) + micros (fixed-length).
Runtime-only — cannot appear in a stored row in v2.11.
Json(String)
v4.9 JSON — raw JSON text. No structural validation
happens at the storage layer; whatever the parser hands us
round-trips verbatim. Equality is byte-wise.
Bytes(Vec<u8>)
v7.10.4 BYTEA — raw binary blob. Equality is byte-wise.
Layout matches Text’s length-prefixed shape ([u32 LE len][bytes]) under tag 18; the engine accepts PG hex
literals ('\xDEADBEEF') and escape literals at the
coercion boundary.
TextArray(Vec<Option<String>>)
v7.10.9 TEXT[] — single-dimension TEXT array with
optional NULL elements. Equality is element-wise. PG’s
NULL-element comparison semantics: NULL ≠ NULL inside
arrays under =, so [NULL] != [NULL] (the engine
honours this).
IntArray(Vec<Option<i32>>)
v7.11.12 INT[] — single-dimension i32 array with optional
NULL elements. Codec mirrors TextArray with i32 LE per
element instead of length-prefixed UTF-8.
BigIntArray(Vec<Option<i64>>)
v7.11.12 BIGINT[] — single-dimension i64 array with optional
NULL elements.
TsVector(Vec<TsLexeme>)
v7.12.0 tsvector — sorted-by-word, deduped lexeme set with
positions + weights. The engine enforces sort/dedup on
construction; consumers can rely on lexemes.windows(2)
being strictly ascending by word.
TsQuery(TsQueryAst)
v7.12.0 tsquery — boolean / phrase parse tree over
lexemes. Engine builds via to_tsquery family.