Data types
Choose types for identifiers, text, numeric values and timestamps.
Choose a column type
Section titled “Choose a column type”| SQL type | Use it for | Application consideration |
|---|---|---|
BOOLEAN |
True/false state | SQL NULL is a separate value |
SMALLINT, INTEGER, BIGINT |
Counts and identifiers | Choose a range that covers future values; clients may return BIGINT as text |
REAL, DOUBLE PRECISION |
Approximate measurements | Compare floating-point results using an appropriate tolerance |
NUMERIC(precision, scale) |
Exact decimal quantities | Preserve decimal precision in your client rather than converting to a binary float |
TEXT, VARCHAR(n) |
Text values | VARCHAR(n) limits character length |
BYTEA |
Binary values | Use your client’s byte-array binding |
DATE |
Calendar dates | Has no time of day |
TIMESTAMP |
Date and time values | Define a consistent application timezone policy |
UUID |
UUID identifiers | Values must use valid UUID syntax |
JSON, JSONB |
JSON documents | Validate the document shape in the application |
INTEGER[] and other typed arrays |
Homogeneous values | Check array and null mappings in your client |
VECTOR(n) |
Embeddings | Use a fixed dimension matching the embedding model |
The types above were checked through the SQL client interface. A client’s returned representation can differ from the JSON HTTP representation.
Example
Section titled “Example”CREATE TABLE docs_types ( id BIGINT PRIMARY KEY, label TEXT, enabled BOOLEAN, amount NUMERIC(10, 2), created_at TIMESTAMP);INSERT INTO docs_types VALUES (1, 'Example', TRUE, 12.50, '2026-01-01 12:00:00');SELECT id, label, enabled, amount, created_at FROM docs_types;Validation errors
Section titled “Validation errors”Out-of-range integers and decimal overflow return SQLSTATE 22003. A value longer than a VARCHAR(n) column returns 22001. Invalid UUID or JSON input returns 22P02. Catch these errors at your application boundary and return a useful validation response.
Behavior
Section titled “Behavior”Use integer identifiers where appropriate, NUMERIC for exact decimal amounts and floating-point types for approximate measurement. Store timestamps with an explicit application timezone policy. VECTOR dimensions must match the embedding model. Check client mappings for decimals, timestamps and nulls.
Related
Section titled “Related”This site uses Google Analytics cookies to count visits. Privacy · License