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 type | Serialized form | Type options | Implementation status |
|---|---|---|---|
text | UTF-8 text | collation | Implemented |
varchar (character varying) | UTF-8 text | length, collation | Implemented |
integer (int/int4) | Base-10 signed integer | min, max, auto_increment | Implemented |
bigint (int8) | Base-10 signed integer | min, max, auto_increment | Implemented |
real (float4) | Decimal or scientific notation | precision, min, max, allow_nan, allow_infinity | Implemented |
numeric (decimal) | Base-10 exact decimal text | precision, scale, min, max | Implemented |
boolean (bool) | true or false | None | Implemented |
date | ISO 8601 date, YYYY-MM-DD | min, max | Implemented |
timestamp | ISO 8601 date-time without offset | precision, min, max | Implemented |
json | JSON text | schema | Implemented |
null | Null-only type | None | Future release |
char (character) | UTF-8 text | length, collation | Future release |
clob | UTF-8 text | collation | Future release |
bit | Bit string containing only 0 and 1 | length | Future release |
varbit (bit varying) | Bit string containing only 0 and 1 | length | Future release |
smallint (int2) | Base-10 signed integer | min, max | Future release |
smallserial (serial2) | Base-10 signed integer generated by writers | start, increment, min, max | Future release |
serial (serial4) | Base-10 signed integer generated by writers | start, increment, min, max | Future release |
bigserial (serial8) | Base-10 signed integer generated by writers | start, increment, min, max | Future release |
double (double precision/float8) | Decimal or scientific notation | precision, min, max, allow_nan, allow_infinity | Future release |
float | Decimal or scientific notation | precision, min, max, allow_nan, allow_infinity | Future release |
money | Base-10 decimal currency amount with no currency symbol | precision, scale, currency, min, max | Future release |
time | ISO 8601 time without offset | precision, min, max | Future release |
time with time zone (timetz) | ISO 8601 time with offset | precision, min, max | Future release |
datetime | ISO 8601 date-time | precision, timezone, min, max | Future release |
timestamp with time zone (timestamptz) | ISO 8601 date-time with offset | precision, min, max | Future release |
interval | ISO 8601 duration or signed duration text | precision, fields | Future release |
uuid | Canonical UUID text | version | Future release |
binary (blob/bytea) | Base64 text | length, max_length, encoding | Future release |
jsonb | JSON text | schema, canonicalize | Future release |
array | JSON array text | element_type, dimensions, min_items, max_items | Future release |
enum | UTF-8 enum label | labels | Future release |
xml | XML text | schema, namespace | Future release |
path | UTF-8 path string | style, absolute, base, must_exist | Future release |
point | Geometric point text | dimensions | Future release |
line | Geometric line text | None | Future release |
lseg | Geometric line segment text | None | Future release |
box | Geometric box text | None | Future release |
polygon | Geometric polygon text | min_points, max_points | Future release |
circle | Geometric circle text | None | Future release |
inet | IP address text | version | Future release |
cidr | CIDR network text | version | Future release |
macaddr | MAC address text | None | Future release |
macaddr8 | EUI-64 MAC address text | None | Future release |
tsvector | Text search vector text | config | Future release |
tsquery | Text search query text | config | Future release |
pg_lsn | Log sequence number text | None | Future release |
pg_snapshot (txid_snapshot) | Transaction snapshot text | None | Future release |
oid | Base-10 unsigned object identifier | min, max | Future release |
regclass (regcollation/regconfig/regdictionary/regnamespace/regoper/regoperator/regproc/regprocedure/regrole/regtype) | UTF-8 object reference text | object_kind | Future release |
range | Text range literal | subtype, bounds | Future release |
multirange | Text multirange literal | subtype, bounds | Future release |
any | Any valid CSDB serialized value | allowed_types | Future release |
custom | Text value with required type_name metadata | type_name, serialized_form | Future 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, andmax_itemsare 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.