pub enum ColumnTypeName {
Show 31 variants
SmallInt,
Int,
BigInt,
Float,
Text,
Varchar(u32),
Char(u32),
Bool,
Vector {
dim: u32,
encoding: VecEncoding,
},
Numeric(u8, u8),
Date,
Timestamp,
Timestamptz,
Json,
Jsonb,
Bytes,
TextArray,
IntArray,
BigIntArray,
TsVector,
TsQuery,
Uuid,
Time,
Year,
TimeTz,
Money,
Range(RangeKindAst),
Hstore,
IntArray2D,
BigIntArray2D,
TextArray2D,
}Expand description
SQL-level type names. The mapping to the storage runtime’s DataType
happens in spg-engine — keeping spg-sql free of storage deps.
Variants§
SmallInt
Int
BigInt
Float
Text
Varchar(u32)
VARCHAR(N) — TEXT capped at N Unicode characters.
Char(u32)
CHAR(N) — TEXT right-padded with spaces to exactly N characters.
Bool
Vector
pgvector fixed-dimension VECTOR(N). v6.0.1 added the
USING <encoding> clause; omitting it surfaces as
encoding = VecEncoding::F32 (the pre-v6 default).
Numeric(u8, u8)
NUMERIC / NUMERIC(p) / NUMERIC(p, s) — exact decimal.
Bare NUMERIC and NUMERIC(p) both surface with scale=0.
Date
DATE — calendar day, no time-of-day component.
Timestamp
TIMESTAMP / MySQL DATETIME — instant with microsecond
precision.
Timestamptz
v7.9.2 TIMESTAMPTZ / TIMESTAMP WITH TIME ZONE. SPG
stores all timestamps as UTC microseconds-since-epoch and
does not carry per-row offset (PG’s internal representation
is the same — TZ is a display convention). The distinction
from TIMESTAMP exists for the PG-wire layer to advertise
OID 1184 so sqlx-style clients decode into
chrono::DateTime<Utc> instead of NaiveDateTime.
Json
v4.9 JSON — text-backed JSON document. No parse-time
validation; the engine round-trips the literal verbatim.
PG OID 114 on the wire.
Jsonb
v7.9.0 JSONB — same storage shape as Json, advertised as
PG OID 3802 on the wire so sqlx-style binary-typed clients
decode without a custom type registration.
Bytes
v7.10.4 BYTES / BYTEA — raw binary blob. PG wire OID 17.
Literal forms (decoded by the engine at coercion time):
- PG hex form:
'\xDEADBEEF' - Escape form:
'foo\\000bar'(backslash octal triples)
TextArray
v7.10.10 TEXT[] — single-dimension TEXT array. PG wire
OID 1009. Literal forms accepted by the parser:
ARRAY['a', 'b', NULL]'{a,b,NULL}'::TEXT[](engine decodes the external form at coerce time)
IntArray
v7.11.13 INT[] — single-dimension i32 array. PG wire OID
1007. Same literal forms as TEXT[] (substituting integer
elements).
BigIntArray
v7.11.13 BIGINT[] — single-dimension i64 array. PG wire
OID 1016.
TsVector
v7.12.0 tsvector — PG full-text search lexeme set. PG
wire OID 3614. Literal: 'foo:1 bar:2'::tsvector (PG
external form). G-CRIT-3.
TsQuery
v7.12.0 tsquery — PG full-text search parse tree. PG
wire OID 3615.
Uuid
v7.17.0 UUID — 128-bit identifier. PG wire OID 2950.
Literal input accepts canonical hyphenated, unhyphenated,
uppercase, and {...}-braced forms; display normalises to
canonical lowercase 8-4-4-4-12. The drop-in PG surface for
Django / Rails / Hibernate id UUID PRIMARY KEY DEFAULT gen_random_uuid().
Time
v7.17.0 Phase 3.P0-32 TIME (without time zone) — i64
microseconds since 00:00:00. PG wire OID 1083. Literal
input is 'HH:MM:SS' with an optional .fraction suffix
(6-digit microsecond precision). Display normalises to
the canonical HH:MM:SS[.ffffff].
Year
v7.17.0 Phase 3.P0-33 MySQL YEAR — u16 in range
1901..=2155 plus the zero-year sentinel 0. No dedicated
PG OID; advertised as INT4 on the wire. Display always
4 digits zero-padded.
TimeTz
v7.17.0 Phase 3.P0-34 PG TIME WITH TIME ZONE (TIMETZ) —
i64 us since 00:00:00 (local) + i32 offset_secs from UTC.
Wire OID 1266. Literal input is 'HH:MM:SS[.ffffff]±HH[:MM]'.
Offset range: ±14 hours.
Money
v7.17.0 Phase 3.P0-35 PG MONEY — i64 cents
(locale-independent storage). Wire OID 790. Literal input
accepts $N.NN, $N,NNN.NN, bare integer (treated as
major units), optional leading -. Display: en_US locale.
Range(RangeKindAst)
v7.17.0 Phase 3.P0-38 PG range types. Pair stores the
element kind tag (Int4 / Int8 / Num / Ts / TsTz / Date)
— the engine bridges to DataType::Range(RangeKind).
Hstore
v7.17.0 Phase 3.P0-39 PG hstore extension type — flat
text => text map with NULL value support.
IntArray2D
v7.17.0 Phase 3.P0-40 — 2D arrays for INT / TEXT / BIGINT.
BigIntArray2D
TextArray2D
Trait Implementations§
Source§impl Clone for ColumnTypeName
impl Clone for ColumnTypeName
Source§fn clone(&self) -> ColumnTypeName
fn clone(&self) -> ColumnTypeName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ColumnTypeName
Source§impl Debug for ColumnTypeName
impl Debug for ColumnTypeName
Source§impl Display for ColumnTypeName
impl Display for ColumnTypeName
impl Eq for ColumnTypeName
Source§impl PartialEq for ColumnTypeName
impl PartialEq for ColumnTypeName
Source§fn eq(&self, other: &ColumnTypeName) -> bool
fn eq(&self, other: &ColumnTypeName) -> bool
self and other values to be equal, and is used by ==.