Types
CSDB values are stored as CSV text and decoded according to the column type.
Implemented Types
The TypeScript runtime currently implements:
| Type | Runtime value | Serialized form |
|---|---|---|
text | string | UTF-8 text |
varchar | string | UTF-8 text, with optional length |
integer | number | Base-10 safe integer |
bigint | bigint | Base-10 integer |
real | number | Decimal or scientific notation |
numeric | string | Exact decimal text |
boolean | boolean | true or false |
date | string | YYYY-MM-DD |
timestamp | string | ISO date-time text |
json | object, array, primitive | JSON text |
custom | string | Text with required type_name metadata |
Null Values
All implemented column types accept null when the column is optional and not
part of the primary key. Required columns and primary key columns cannot be
null.
- TypeScript row values include
null. - Unquoted empty CSV fields decode as
nullfor optional, non-primary-key columns. nullserializes as an unquoted empty CSV field.- Quoted empty strings, written as
"", remain empty strings and do not becomenull. - Missing values in inserted rows are filled from defaults when a default exists;
otherwise they become
nullfor optional, non-primary-key columns. - Explicit
nullvalues are preserved and are not replaced by defaults.
SQL can use the NULL literal and IS NULL / IS NOT NULL predicates.
Aliases
| Alias | Canonical type |
|---|---|
character varying | varchar |
int, int4 | integer |
int8 | bigint |
decimal | numeric |
bool | boolean |
Type Objects
Use object form when a type needs options.
columns:
code:
type: varchar
length: 20
amount:
type: numeric
precision: 12
scale: 2
location:
type: custom
type_name: geography_point
Future Registry
The CSDB v1 specification also names future types such as char, smallint, double, time, uuid, binary, jsonb, array, enum, xml, geometric types, network types, range types, any, and engine-specific custom types.