Data Types#
MuduDB stores values as typed objects. The SQL parser maps SQL type names to internal scalar kinds. Each type has a fixed or variable in-memory representation and well-defined comparison and serialization behaviour.
Overview#
Types are divided into scalar and complex categories:
Scalar — single atomic values (numbers, strings, temporal values).
Complex —
ARRAY,RECORD, andBINARY.
All scalar types support ordering and equality comparison. Complex types have structural comparison rules.
The following table summarises the SQL type names recognised by the parser and their internal mappings.
SQL Type |
Internal Kind |
Notes |
|---|---|---|
|
|
32-bit signed integer |
|
|
64-bit signed integer |
|
|
128-bit signed integer |
|
|
32-bit IEEE-754 float |
|
|
64-bit IEEE-754 float |
|
|
Arbitrary-precision decimal |
|
|
Alias for |
|
|
Fixed-length string (padded) |
|
|
Variable-length string |
|
|
Unbounded text |
|
|
Calendar date |
|
|
Time of day with optional fractional-second precision |
|
|
Date+time without time zone |
|
|
Date+time with time zone |
|
|
Ordered collection of elements |
|
|
Structured object with named fields |
|
|
Raw byte sequence |
Nullability#
Every column is nullable by default unless declared NOT NULL or marked as part of a PRIMARY KEY. NULL is a valid literal in INSERT and UPDATE statements.
CREATE TABLE example (
id INT PRIMARY KEY, -- implicitly NOT NULL
name CHAR(32) NOT NULL, -- explicitly NOT NULL
note VARCHAR(200) -- nullable by default
);
Unsupported Types#
The following types are recognised by the grammar but not yet implemented in the SQL parser:
BOOLEANINTEGER(useINTinstead)SMALLINTTINYINT
Additionally, the internal type U128 (OID) has no SQL keyword mapping in v0.1.
Attempting to create a column with any unsupported type results in a “not yet implemented” error.