pub enum Literal {
Integer(i64),
Float(f64),
Numeric {
unscaled: i128,
scale: u16,
},
NumericBig(String),
String(String),
Bool(bool),
Null,
Vector(Vec<f32>),
TextArray(Vec<Option<String>>),
IntArray(Vec<Option<i32>>),
BigIntArray(Vec<Option<i64>>),
Interval {
months: i32,
days: i32,
micros: i64,
text: String,
},
}Variants§
Integer(i64)
Float(f64)
Numeric
Exact decimal literal — a bare 12.34-style token, kept as
unscaled / 10^scale so no precision or trailing-zero scale is lost
before it becomes a Value::Numeric. PG parses such literals as
numeric, not double precision. (Scientific/huge literals stay
Float.)
Fields
NumericBig(String)
v7.38 (read01, T3.C3) — an exact decimal literal whose mantissa overflows
i128 (kept as its source digit string, [-]digits[.digits]). Becomes a
Value::NumericBig at eval; previously such literals fell back to double.
String(String)
Bool(bool)
Null
Vector(Vec<f32>)
pgvector-style array literal, e.g. [1, 2.5, -3].
TextArray(Vec<Option<String>>)
TEXT[] value carried through the prepared-bind path
(= ANY($1) has no column context to re-parse a {a,b}
text form, so the array rides the AST natively).
IntArray(Vec<Option<i32>>)
INT[] value carried through the prepared-bind path.
BigIntArray(Vec<Option<i64>>)
BIGINT[] value carried through the prepared-bind path.
Interval
INTERVAL '<n> <unit> [<n> <unit> ...]' — calendar-aware span.
Three independent dimensions: months (variable-length;
year/month), days (fixed 86400 seconds at non-DST, but
preserved as its own dimension so '1 day' ≠ '24 hours'
stays distinguishable), and micros (sub-day; can carry).
text keeps the original spelling so Display round-trips
byte-for-byte. v7.37.5 β added the days field for PG parity.