pub enum ColumnTypeName {
Show 69 variants
Name,
Xid,
Xid8,
Oid,
SmallInt,
Int,
BigInt,
Float,
Real,
Text,
Varchar(u32),
Char(u32),
Bool,
Vector {
dim: u32,
encoding: VecEncoding,
},
Numeric(u16, i16),
Date,
Timestamp,
Timestamptz,
Json,
Jsonb,
Bytes,
TextArray,
IntArray,
BigIntArray,
TsVector,
TsQuery,
Uuid,
Time,
Year,
TimeTz,
Money,
Range(RangeKindAst),
Hstore,
IntArray2D,
BigIntArray2D,
TextArray2D,
BoolArray2D,
Interval,
IntervalArray,
BoolArray,
SmallIntArray,
FloatArray,
NumericArray,
DateArray,
TimestampArray,
TimestamptzArray,
UuidArray,
JsonArray,
JsonbArray,
BytesArray,
VarcharArray,
CharArray,
Multirange(RangeKindAst),
Point,
Lseg,
Path,
PgBox,
Polygon,
Line,
Circle,
Inet,
Cidr,
Macaddr,
Macaddr8,
Bit(u32),
BitVarying(u32),
Xml,
Char1,
MoneyArray,
}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§
Name
v7.39 (round 291) — PG’s name, the identifier type its
catalogs use. CREATE TABLE t (a name) is legal SQL that SPG
answered type "name" does not exist to.
Xid
v7.39 (round 640) — PG’s transaction-id types. xid is the
32-bit wrapping counter the row header carries; xid8 is the
64-bit monotonic one. CREATE TABLE t (a xid) is legal SQL that
SPG answered type "xid" does not exist to.
Xid8
Oid
v7.39 (round 667) — OID. XID was already a column type here
and OID was not, so CREATE TABLE t(o OID) answered
type "oid" does not exist while t(x XID) built fine.
SmallInt
Int
BigInt
Float
Real
v7.39 (round 269) — REAL / FLOAT4 / FLOAT(1..24): 32-bit
IEEE. It used to map to Self::Float on the theory that a
wider float is harmless, but the width is observable: a real
column holding 0.1 stored the f64 0.1, so r = 0.1::real
answered false where PG answers true.
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(u16, i16)
NUMERIC / NUMERIC(p) / NUMERIC(p, s) — exact decimal.
Bare NUMERIC and NUMERIC(p) both surface with scale=0.
v7.39 (round 271) — scale widened to u16 alongside the value’s.
v7.39 (round 272) — precision too: PG’s runs to 1000.
v7.39 (round 273) — the DECLARED scale is signed (-1000..=1000);
a negative one rounds to tens / hundreds. A VALUE’s display scale
stays unsigned.
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
BoolArray2D
v7.39 (read01 round 75) — bool[][].
Interval
v7.37.5 β-P2 — INTERVAL as a column type. Storage is the
three-field {months, days, micros} struct (PG-byte-equal),
catalog tag 34, FILE_VERSION 48+. Wire OID 1186. Prior to
β-P2 INTERVAL was runtime-only — literal in expression
position but rejected at CREATE TABLE.
IntervalArray
v7.37.5 β-P4 — INTERVAL[] — single-dimension array of
INTERVAL. Wire OID 1187 (_interval). Catalog tag 35.
PG external form quotes each non-NULL element because
interval text contains spaces / colons
({"1 day","24:00:00",NULL}).
BoolArray
v7.37.5 γ — full PG array-of-scalar family. Each variant
mirrors a scalar ColumnTypeName that already existed.
SmallIntArray
FloatArray
NumericArray
DateArray
TimestampArray
TimestamptzArray
UuidArray
JsonArray
JsonbArray
BytesArray
VarcharArray
CharArray
Multirange(RangeKindAst)
v7.37.5 δ — PG 14+ multirange types. Same wrapper pattern
as Range(RangeKindAst) — one column type variant covers
all six builtin multiranges, kind pins the element type.
Wire OIDs in pgwire.
Point
v7.37.5 ε — PG geometry scalar family. Each maps one-to- one to a PG type: point/lseg/path/box/polygon/line/circle. Wire OIDs in pgwire.
Lseg
Path
PgBox
Polygon
Line
Circle
Inet
v7.37.5 ζ-A — PG network / bit / xml / “char” / money[].
Cidr
Macaddr
Macaddr8
Bit(u32)
v7.39 (round 281) — BIT(n); 0 = no typmod (PG: bit(1)).
BitVarying(u32)
v7.39 (round 281) — BIT VARYING(n); 0 = unbounded.
Xml
Char1
MoneyArray
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 more