Skip to main content

Types and Values

CSDB v1 defines a broad type registry inspired by PostgreSQL and SQLite. Types do not imply a specific database engine.

Every value is serialized as text inside CSV.

Type Registry

Each row starts with the canonical CSDB type name. Equivalent database spellings are shown in parentheses. Writers should preserve the exact spelling used in the schema, but libraries should normalize aliases to the canonical type internally.

Type options are stored under a columns entry when that entry uses object form. Options include SQL type modifiers, SQLite-compatible declared-type hints, and CSDB validation or encoding hints.

Canonical typeSerialized formType optionsImplementation status
textUTF-8 textcollationImplemented
varchar (character varying)UTF-8 textlength, collationImplemented
integer (int/int4)Base-10 signed integermin, max, auto_incrementImplemented
bigint (int8)Base-10 signed integermin, max, auto_incrementImplemented
real (float4)Decimal or scientific notationprecision, min, max, allow_nan, allow_infinityImplemented
numeric (decimal)Base-10 exact decimal textprecision, scale, min, maxImplemented
boolean (bool)true or falseNoneImplemented
dateISO 8601 date, YYYY-MM-DDmin, maxImplemented
timestampISO 8601 date-time without offsetprecision, min, maxImplemented
jsonJSON textschemaImplemented
nullNull-only typeNoneFuture release
char (character)UTF-8 textlength, collationFuture release
clobUTF-8 textcollationFuture release
bitBit string containing only 0 and 1lengthFuture release
varbit (bit varying)Bit string containing only 0 and 1lengthFuture release
smallint (int2)Base-10 signed integermin, maxFuture release
smallserial (serial2)Base-10 signed integer generated by writersstart, increment, min, maxFuture release
serial (serial4)Base-10 signed integer generated by writersstart, increment, min, maxFuture release
bigserial (serial8)Base-10 signed integer generated by writersstart, increment, min, maxFuture release
double (double precision/float8)Decimal or scientific notationprecision, min, max, allow_nan, allow_infinityFuture release
floatDecimal or scientific notationprecision, min, max, allow_nan, allow_infinityFuture release
moneyBase-10 decimal currency amount with no currency symbolprecision, scale, currency, min, maxFuture release
timeISO 8601 time without offsetprecision, min, maxFuture release
time with time zone (timetz)ISO 8601 time with offsetprecision, min, maxFuture release
datetimeISO 8601 date-timeprecision, timezone, min, maxFuture release
timestamp with time zone (timestamptz)ISO 8601 date-time with offsetprecision, min, maxFuture release
intervalISO 8601 duration or signed duration textprecision, fieldsFuture release
uuidCanonical UUID textversionFuture release
binary (blob/bytea)Base64 textlength, max_length, encodingFuture release
jsonbJSON textschema, canonicalizeFuture release
arrayJSON array textelement_type, dimensions, min_items, max_itemsFuture release
enumUTF-8 enum labellabelsFuture release
xmlXML textschema, namespaceFuture release
pathUTF-8 path stringstyle, absolute, base, must_existFuture release
pointGeometric point textdimensionsFuture release
lineGeometric line textNoneFuture release
lsegGeometric line segment textNoneFuture release
boxGeometric box textNoneFuture release
polygonGeometric polygon textmin_points, max_pointsFuture release
circleGeometric circle textNoneFuture release
inetIP address textversionFuture release
cidrCIDR network textversionFuture release
macaddrMAC address textNoneFuture release
macaddr8EUI-64 MAC address textNoneFuture release
tsvectorText search vector textconfigFuture release
tsqueryText search query textconfigFuture release
pg_lsnLog sequence number textNoneFuture release
pg_snapshot (txid_snapshot)Transaction snapshot textNoneFuture release
oidBase-10 unsigned object identifiermin, maxFuture release
regclass (regcollation/regconfig/regdictionary/regnamespace/regoper/regoperator/regproc/regprocedure/regrole/regtype)UTF-8 object reference textobject_kindFuture release
rangeText range literalsubtype, boundsFuture release
multirangeText multirange literalsubtype, boundsFuture release
anyAny valid CSDB serialized valueallowed_typesFuture release
customText value with required type_name metadatatype_name, serialized_formFuture release

Type Option Rules

  • Options are written inside the column's object-form entry.
  • Unknown options are invalid unless the column type is custom.
  • Value limits such as min, max, min_items, and max_items are validation hints; equivalent database exports may also represent them as constraints.

Parameterized Types

Types may include metadata such as length, precision, scale, dimensions, or allowed labels.

columns:
code:
type: varchar
length: 20
amount:
type: numeric
precision: 12
scale: 2
status:
type: enum
labels: [draft, approved, paid]
required:
- code
- amount
- status

Custom Types

Unknown or engine-specific types use custom.

columns:
location:
type: custom
type_name: geography_point

type_name is required when type is custom.

Unsupported Runtime Types

A CSDB runtime may preserve and validate a type even when its target database or language does not natively support that type.