#[non_exhaustive]pub enum Value {
Show 31 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),
Uuid([u8; 16]),
Time(i64),
Year(u16),
TimeTz {
us: i64,
offset_secs: i32,
},
Money(i64),
Hstore(Vec<(String, Option<String>)>),
IntArray2D(Vec<Vec<Option<i32>>>),
BigIntArray2D(Vec<Vec<Option<i64>>>),
TextArray2D(Vec<Vec<Option<String>>>),
Range {
kind: RangeKind,
lower: Option<Box<Value>>,
upper: Option<Box<Value>>,
lower_inc: bool,
upper_inc: bool,
empty: bool,
},
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.
Uuid([u8; 16])
v7.17.0 uuid — 128-bit identifier. Stored as 16 bytes
(big-endian / network-byte order, same as RFC 4122).
Display normalises to canonical lowercase 8-4-4-4-12
hyphenated form. Equality is byte-wise.
Time(i64)
v7.17.0 Phase 3.P0-32 — PG time (without time zone) —
i64 microseconds since 00:00:00. Range 0..86_400_000_000.
Display: HH:MM:SS zero-padded, with optional .ffffff
suffix when fractional is non-zero.
Year(u16)
v7.17.0 Phase 3.P0-33 — MySQL YEAR — u16 in range
1901..=2155 plus the special zero-year sentinel 0.
Display always 4 digits zero-padded (0000 for the
sentinel; 1985/2007 otherwise).
TimeTz
v7.17.0 Phase 3.P0-34 — PG time with time zone — i64
microseconds since 00:00:00 in the LOCAL wall clock PLUS
an i32 offset-from-UTC in seconds. PG preserves the
offset on output, so the wall-clock value is NOT shifted
to UTC at storage time. Offset range: ±50400 seconds
(±14 hours).
Money(i64)
v7.17.0 Phase 3.P0-35 — PG money — i64 cents
(locale-independent storage; the en_US locale renders on
display via $N,NNN.CC).
Hstore(Vec<(String, Option<String>)>)
v7.17.0 Phase 3.P0-39 — PG hstore value: flat
text => text map with NULL value support. Insertion
order preserved on input; duplicate keys take last-write-
wins at parse time.
IntArray2D(Vec<Vec<Option<i32>>>)
v7.17.0 Phase 3.P0-40 — 2D INT matrix (row-major).
BigIntArray2D(Vec<Vec<Option<i64>>>)
v7.17.0 Phase 3.P0-40 — 2D BIGINT matrix (row-major).
TextArray2D(Vec<Vec<Option<String>>>)
v7.17.0 Phase 3.P0-40 — 2D TEXT matrix (row-major).
Range
v7.17.0 Phase 3.P0-38 — PG range value. One shape covers
all six builtin range types; kind pins the element type
(must match the column’s DataType::Range(kind)).
lower / upper are None for the unbounded sides;
lower_inc / upper_inc mirror the canonical PG
[ / ( / ] / ) bracket inclusivity. empty=true
supersedes all other fields (the empty range has no
bounds).