pub enum DataType {
}Expand description
Runtime type tags. Vector { dim, encoding } / Varchar(max) /
Char(size) are parameterised; the parameter travels with both
the column schema and the on-wire serialised representation.
Variants§
SmallInt
16-bit signed. Backed by Value::SmallInt(i16); arithmetic that
would overflow surfaces as a type error at INSERT time.
Int
BigInt
Float
Text
Varchar(u32)
VARCHAR(n) — same byte representation as Text, but INSERT
rejects values longer than n Unicode characters.
Char(u32)
CHAR(n) — same representation as Text, but INSERT right-pads
with U+0020 to exactly n Unicode characters (or rejects when
the input is already longer).
Bool
Vector
pgvector-style fixed-dimension vector. encoding selects
the in-cell representation (F32 = pre-v6 raw f32 buffer;
Sq8 = v6.0.1 8-bit scalar-quantised). The DDL grammar
surfaces encoding via the optional USING <encoding>
clause: VECTOR(128) USING SQ8.
Numeric
NUMERIC(precision, scale) — exact fixed-point decimal stored as
a scaled i128. precision caps total decimal digits, scale
fixes digits after the decimal point. v1.12 supports up to
precision 38 (the i128-safe ceiling). NUMERIC and NUMERIC(p)
surface as Numeric { precision: p, scale: 0 }.
Date
DATE — calendar date with day precision, stored as i32 days
since the Unix epoch (1970-01-01).
Timestamp
TIMESTAMP (a.k.a. MySQL DATETIME) — instant with microsecond
precision, stored as i64 microseconds since the Unix epoch.
Timestamptz
v7.9.2 TIMESTAMPTZ — bit-identical to Timestamp on disk
(i64 microseconds, UTC by convention). Carried as a distinct
type tag so the PG-wire layer can advertise OID 1184 (PG’s
timestamp with time zone) and sqlx/pgx/JDBC clients
decode into their TZ-aware datetime types. The internal
semantics are unchanged: SPG never stored per-row offsets,
and neither did PG — TIMESTAMPTZ in PG is also UTC i64.
Interval
INTERVAL — calendar-aware span (months + microseconds). v2.11
supports INTERVAL only as a runtime intermediate (literals,
arithmetic results); on-disk encoding is rejected so this branch
can’t appear in a ColumnSchema.
Json
v4.9: JSON — text-backed JSON document. We don’t parse
the content (no path operators or jsonb functions yet) —
the column accepts any TEXT-compatible value and round-trips
it verbatim. PG OID 114 on the wire.
Jsonb
v7.9.0: JSONB — semantically identical to Json on
the storage side (same Value::Json cells, same
row codec), but advertised as PG OID 3802 on the wire
so sqlx-style clients that bind jsonb columns
decode correctly. mailrs migration blocker #3.
Bytes
v7.10.4: BYTES / BYTEA — variable-length raw binary.
Backed by Value::Bytes(Vec<u8>). PG wire OID 17. Literal
forms accepted by parser/engine: PG hex form '\xDEADBEEF'
(case-insensitive hex pairs) and escape form
'foo\\000bar' (the latter decoded at coercion time when
the target column is BYTEA — TEXT columns leave the
backslash sequence verbatim).
TextArray
v7.10.9: TEXT[] — single-dimension TEXT array. Elements
may be NULL (PG semantics). PG wire OID 1009. Literal
forms: ARRAY['a', 'b', NULL] and the PG external form
'{a,b,NULL}'::TEXT[]. Engine implements = ANY(arr),
<> ALL(arr), and 1-based indexing arr[i]. Catalog
FILE_VERSION 18+; older snapshots reject this DataType
(forward-only by design — TEXT[] columns aren’t readable
on a pre-v7.10 binary).
IntArray
v7.11.12: INT[] — single-dimension i32 array. PG wire
OID 1007 (_int4). Same ARRAY[...] / '{1,2,3}'::INT[]
literal surface as TEXT[]. Catalog FILE_VERSION 19+.
BigIntArray
v7.11.12: BIGINT[] — single-dimension i64 array. PG
wire OID 1016 (_int8). Catalog FILE_VERSION 19+.
TsVector
v7.12.0: PG tsvector — ordered, deduplicated set of
(lexeme, positions, weight) tuples. PG wire OID 3614.
Catalog FILE_VERSION 20+. Storage shape is row-codec
tag 22; the schema-agnostic write_value path emits tag
18. Literal: 'foo:1 bar:2,3'::tsvector (PG external
form). G-CRIT-3 entry — v7.12.0 only ships the type +
codec; matching @@ lands in v7.12.2.
TsQuery
v7.12.0: PG tsquery — parse tree of lexemes joined by
& | ! and phrase operators. PG wire OID 3615.
Catalog FILE_VERSION 20+.