Data types

Every column type in v0.1.0 — names, OIDs, literals, arrays, and user types.

Version
Latest
v0.1.0 · latest 2 min read

Every type below works in DDL, casts, and expressions. PostgreSQL-isms that resolve but carry limited semantics are grouped at the bottom — they store and cast correctly but don't imply full PostgreSQL behavior for the type.

Family Names Notes
Integers `smallint int2, integer
Float `real float4, double
Exact `numeric decimal
Text text, `varchar character varying[(n)], CHAR→varchar`
Bool `boolean bool`
Date/time date, `time [with without tz], timestamp […], timestamptz, interval`
JSON json, jsonb text vs canonical binary storage
UUID uuid
Binary bytea, bit, varbit (bit varying), B'…' literals
Network inet, cidr, macaddr, macaddr8 address storage and casts
Full-text markers tsvector, tsquery resolve and store; no text-search index in v0.1.0
Geometric/range point…circle, int4range (+ int8range, numrange, tsrange, tstzrange, daterange as storable/castable), multiranges range constructors exist for int4range/int4multirange; other ranges store and cast
Arrays TYPE[] ARRAY[…], arr[i] 1-based
User CREATE TYPE … AS ENUM / AS (cols), CREATE DOMAIN … OIDs from 16384
Catalog/system oid, regclass, regtype, regproc, regprocedure, regoper, regoperator, regconfig, regdictionary, regrole, regnamespace, regcollation, tid, xid, cid, pg_lsn, pg_snapshot, aclitem, money, int2vector, oidvector resolve for catalog queries, casts, and function signatures; not general-purpose column types — prefer the families above for application data

Pseudo-types are rejected as column types (record only via ROW(…) values). Length/precision modifiers ((n)/(n,m)) are preserved through casts and DDL. Multi-word names (double precision, character varying, timestamp with time zone) work everywhere single-word names do.

sqlsource
CREATE TABLE t (
  a INT, b BIGINT, c NUMERIC(12,2), d TEXT, e VARCHAR(10),
  f BOOLEAN, g DATE, h TIMESTAMPTZ, i INTERVAL, j JSONB, k TEXT[], l UUID
);
SELECT 1::bigint, 'x'::text, '[1,2]'::jsonb, B'0101';

Related: Type conversion · Constraints

Was this page helpful?