Data types
Scalar, temporal and nested types in VegaDB SQL and how they reach clients.
Numeric
| Type | Notes |
|---|---|
TINYINT, SMALLINT, INTEGER, BIGINT, HUGEINT | Signed integers from 8 to 128 bits. |
UTINYINT, USMALLINT, UINTEGER, UBIGINT, UHUGEINT | Unsigned integer families. Client binary support varies; text is portable. |
DECIMAL(p, s) / NUMERIC(p, s) | Exact fixed-point numbers. Choose scale deliberately for money. |
REAL, FLOAT, DOUBLE | IEEE floating-point families. Not exact decimal storage. |
Arithmetic follows VegaDB type-promotion rules, which match DuckDB's. Integer overflow raises an error; use TRY_CAST when conversion failure should return NULL.
Boolean and text
BOOLEAN, VARCHAR, TEXT, CHAR, BLOB, BIT and ENUM are supported. VARCHAR length is not a storage limit. Use a check or application contract when length is part of the business rule.
Temporal
| Type | Meaning |
|---|---|
DATE | Calendar date without time. |
TIME, TIME_NS | Time of day, with microsecond or nanosecond precision. |
TIMETZ | Time of day with time-zone offset. |
TIMESTAMP, TIMESTAMP_NS | Date and time without time zone. |
TIMESTAMPTZ | Absolute instant rendered in a session time zone. |
INTERVAL | Months, days and microseconds as distinct components. |
SELECT
TIMESTAMPTZ '2026-09-03 10:00:00+04:00',
date_trunc('hour', event_time),
event_time AT TIME ZONE 'UTC';UUID and JSON
UUID and JSON are available. JSON text is validated when cast. Use typed nested data when the schema is stable and JSON when its shape is genuinely open.
SELECT
payload->>'event_type' AS event_type,
json_extract(payload, '$.items[0].sku') AS first_sku
FROM raw_events;LIST and ARRAY
LIST stores a variable-length homogeneous sequence. ARRAY stores a fixed-length homogeneous sequence.
SELECT [1, 2, 3]::INTEGER[] AS values,
array_value(0.12, 0.44, 0.91)::DOUBLE[3] AS embedding;Lists support slicing, containment, concatenation, ordering, filtering, transformation, reduction, zipping and flattening. Fixed arrays support distance, dot product and cosine functions useful for vector work.
STRUCT
STRUCT is a typed record with named fields.
SELECT {
name: 'Mira',
address: {city: 'Dubai', country: 'AE'}
}::STRUCT(
name VARCHAR,
address STRUCT(city VARCHAR, country VARCHAR)
) AS customer;Access a field with dot notation or struct_extract. Names are part of the type identity.
MAP
MAP(K, V) contains key/value pairs with a single key type and value type.
SELECT map(['currency', 'channel'], ['AED', 'web']) AS attributes;UNION and VARIANT
UNION is a tagged choice among declared member types. VARIANT holds recursive semi-structured values while retaining native scalar/container identity.
Results reach clients as Arrow data. Flight SQL, Spark Connect and the HTTP SQL API's Arrow and Parquet formats keep LIST, ARRAY, STRUCT, MAP and UNION values as their native nested types; the HTTP API's text formats render them as text. Prepared parameters carry their Arrow type; cast a parameter when its target type cannot be inferred.
NULL and nested values
The container can be NULL, and values inside it can be NULL. Those are distinct cases. A NULL inside a nested parameter value stays a NULL of the field's type; it is not treated as an untyped SQL string.