Data Types

This page lists the SQL type names the engine accepts, how values of each type are held in memory and on disk, how values are converted when they are written to a column or cast, and which PostgreSQL type OID a result column reports on the wire. The byte-level wire encodings are described in the PostgreSQL protocol reference; this page does not repeat them.

How a declared type is kept

The parser does not resolve a column type to an internal enum. parse_data_type returns the declared type as a normalised string, and that string is stored in the column definition (ColumnDef.data_type: String). Every later decision (assignment coercion, cast checks, reported OID) re-reads that string. (source: src/query/sql/parser.rs, parse_data_type; src/plan/logical.rs, ColumnDef)

parse_data_type applies these rules to the text after the column name:

Input form What is kept
Plain identifier (int, text, jsonb, user type names) The identifier
Schema-qualified name (public.vector, pg_catalog.int4) The last part only
DOUBLE PRECISION, CHARACTER VARYING, BIT VARYING The two-word name
Parameters (n) or (n, m) Kept in the string, for example numeric(10,2)
WITH TIME ZONE after timestamp or time Rewritten to TIMESTAMPTZ / TIMETZ; precision parameters are kept
WITHOUT TIME ZONE Dropped
[] or [n] suffix Array of the element type; the dimension n is ignored
MySQL UNSIGNED, ZEROFILL, CHARACTER SET x Dropped
MySQL ENUM('a','b'), SET('a','b') Kept with the value list
VECTOR(n) Kept with the dimension
SERIAL, BIGSERIAL, SMALLSERIAL Kept; the default sequence is created by CREATE TABLE (see Constraints and sequences)

(source: src/query/sql/parser.rs, parse_data_type)

Runtime values

Every value the executor handles is one variant of the Value enum. The table lists the variants and what produces them.

Variant Holds Typical source
Null nothing NULL, missing column
Boolean bool true, comparisons
Int8, Int16, Int32, Int64, Integer signed integers; Integer is an i64 literals and integer columns
Float32, Float64, Float IEEE floats wrapped in OrderedFloat real, double precision, float literals
Decimal { value: i128, scale: u8 } scaled integer numeric arithmetic
String UTF-8 text text columns and most typed values stored as text (see below)
Bytes raw bytes bytea and MySQL binary types
Timestamp(i64) microseconds since the Unix epoch timestamp arithmetic
Date(i32) days since the Unix epoch date arithmetic
Time(i64) microseconds since midnight time values
Interval { months, days, micros } three-part interval as in PostgreSQL interval casts and arithmetic
Uuid 16 bytes UUID functions
Vector Vec<f32> pgvector values
Json, Jsonb serde_json::Value JSON functions and operators
Array Vec<Value> ARRAY[...], array functions
Map key/value pairs document and graph paths
Edge, Reference graph edge and record reference Cypher and document paths

(source: src/types/value.rs, Value)

Rows are stored and passed between plan nodes as text cells (Vec<Option<String>>), not as Value. A typed value written to a table is rendered to its canonical text form at assignment time, and the projection path turns a cell back into a Value by its shape: integer, then decimal, then float, then true/false, else string. (source: src/query/engine.rs, coerce_assign_value_inner, parse_string_to_value)

This has two consequences engineers should know:

  • A jsonb, array, interval, range or tsvector column is held as its PostgreSQL text form and re-parsed when an operator needs the structure. The status note for correlated unnest records that array columns are still read back as text inside the engine. (source: src/query/engine.rs, coerce_assign_value_inner; docs/status/2026-11-30-correlated-unnest-array-concat.md)
  • A text cell that happens to look like a number is re-typed as a number when it reaches a function through the projection path. Not verified: whether string functions such as upper or length over a text column holding '123' return the PostgreSQL answer in every evaluator path; no test isolates that case. (source: src/query/engine.rs, delegate_to_row_expr, parse_string_to_value)

Two other type enums exist. ColumnType in src/types/schema.rs describes columns for the document and storage layers, and DataType in src/types/mod.rs is used by the migration tooling. Neither is consulted when a SQL column is written. (source: src/types/schema.rs, ColumnType; src/types/mod.rs, DataType)

Accepted type names and reported OIDs

PgTypeOid::from_type_name maps a declared type name, case-insensitively, to the OID that the PostgreSQL wire reports for a column of that type. Names it does not recognise map to Unknown, which reportable_type reports as text (OID 25).

SQL names accepted Reported type OID
bool, boolean bool 16
int2, smallint, ClickHouse Int16 int2 21
int, int4, integer, serial, ClickHouse Int32, UInt8, UInt16 int4 23
int8, bigint, bigserial, ClickHouse Int64, UInt32, UInt64 int8 20
float4, real, ClickHouse Float32 float4 700
float8, double, double precision, float, ClickHouse Float64 float8 701
numeric, decimal, numeric(p,s), decimal(p,s) numeric 1700
varchar, character varying, varchar(n), ClickHouse FixedString(n) varchar 1043
text, ClickHouse String text 25
char, character, char(n) bpchar 1042
bytea, MySQL binary, varbinary, blob, tinyblob, mediumblob, longblob, binary(n), varbinary(n) bytea 17
date date 1082
time, time(p) time 1083
timetz, time with time zone timetz 1266
timestamp, timestamp(p), MySQL datetime timestamp 1114
timestamptz, timestamp with time zone timestamptz 1184
uuid uuid 2950
interval interval 1186
json json 114
jsonb jsonb 3802
tsvector tsvector 3614
tsquery tsquery 3615
oid oid 26
hstore, public.hstore hstore 16390
vector, vector(n), public.vector(n) vector 16384
void void 2278
T[] for bool, int2, int4, int8, varchar, float4, float8, numeric the matching array type 1000, 1005, 1007, 1016, 1015, 1021, 1022, 1231
T[] for any other element type, and _text text[] 1009

(source: src/query/types.rs, PgTypeOid::from_type_name, PgTypeOid::array_of; src/query/engine.rs, reportable_type)

hstore (16390) and vector (16384) are fixed OIDs chosen by the engine; PostgreSQL assigns extension type OIDs at install time, so a client that caches OIDs by name from pg_type must read them from this server. (source: src/query/types.rs, PgTypeOid)

Types that are accepted in DDL but have no OID of their own, and are therefore reported as text: smallserial, inet, cidr, macaddr, bit, money, xml, MySQL tinyint, mediumint, enum(...), set(...), and every user-defined enum, composite, range and domain. (source: src/query/types.rs, PgTypeOid::from_type_name)

The type of a computed result column is chosen by infer_expression_type, not by from_type_name. Function result types are listed with each function in Functions and operators. (source: src/query/engine.rs, infer_expression_type)

Tested by the feature-matrix DDL-types scenarios int, bigint, smallint, numeric-ps, real, double, bool, text, varchar-n, char-n, date, time, timestamp, timestamptz, interval, uuid, bytea, json, jsonb, array-int, inet, serial and hstore, which round-trip a value through a column and compare against PostgreSQL 16, and by the unit tests test_pg_type_oid, test_pg_type_from_name and test_column_info. (source: test-scripts/feature-matrix/features.py; src/query/types.rs, tests)

Assignment coercion

When INSERT, UPDATE or COPY writes a value into a column, coerce_assign_value converts it according to the column's declared type string. The rules, in the order they are tried:

| Column type | Rule | Error on failure | |—|—|—| | any array type | Value rendered as PostgreSQL array text {a,b} | none | | vector, vector(n) | Parsed as a float list; empty, NaN and infinite elements rejected; dimension checked against n | data exception expected n dimensions, not m | | jsonb | Parsed and re-rendered in PostgreSQL's jsonb text form: duplicate keys collapsed to the last, keys ordered shortest first then bytewise, one space after , and : | 22P02 invalid input syntax for type json | | json | Must parse; original text kept | 22P02 | | interval | Parsed by parse_interval_string, stored as PostgreSQL interval text | 22P02 | | hstore | Parsed and stored as canonical "k"=>"v" pairs | type mismatch | | bytea | Text starting \x, 0x or x followed by an even number of hex digits is decoded; anything else is taken as raw bytes | none | | MySQL binary(n) | Raw bytes, right-padded with zero bytes to n | none | | int2, int4, int8 and their aliases | Range checked; a float with no fractional part is accepted; text parsed | 22003 value "x" is out of range for type ...; 22P02 for bad text | | numeric(p,s) | Rounded to s places with ties away from zero (decimal_round_to_i128); precision checked | 22003 numeric field overflow | | varchar(n), char(n) | Length checked in characters; for char(n) trailing spaces do not count | 22001 string data right truncation | | real, double precision | Numeric values converted to float; text parsed | 22P02 | | boolean into a numeric column | true becomes 1, false 0 | none | | timestamp, datetime | A date-only string gets ` 00:00:00 appended; an ISO T separator becomes a space; a computed timestamp value is rendered as YYYY-MM-DD HH:MI:SS[.ffffff] | none found | | date | An unpadded Y-M-D string is zero-padded; a computed date value is rendered as YYYY-MM-DD | none found | | enum types | Value must be one of the labels | invalid input value for enum` | | domain types | Base-type rules, then the domain's checks (see below) | 23514 |

(source: src/query/engine.rs, coerce_assign_value, coerce_assign_value_inner, coerce_value_to_numeric_scale, coerce_bytea_value, validate_domain_value; src/query/pgvector.rs, cast, check_dims; src/query/json_ops.rs, pg_jsonb_text)

char(n) values are stored without trailing blanks and padded back to n when a PostgreSQL client reads them (bpchar_width, pad_bpchar_cells). (source: src/query/engine.rs, pad_bpchar_cells; docs/status/2026-11-30-pg-result-types.md)

In the MySQL dialect the integer bounds widen for UNSIGNED columns, tinyint and mediumint have their MySQL ranges, an empty string becomes 0 in non-strict mode, and a numeric overflow reports Out of range value for column. (source: src/query/engine.rs, coerce_assign_value_inner)

COPY FROM uses a precomputed per-column plan (CopyFastCoerce) that applies the same rules without re-reading the type string for every row. (source: src/query/engine.rs, CopyFastCoerce)

Not verified: uuid, inet, cidr, date, time and timestamp columns do not validate their input on assignment in the code paths read (text that matches none of the rules is passed through), so a malformed value appears to be stored as text. No feature-matrix scenario probes a malformed value for these types. (source: src/query/engine.rs, coerce_assign_value_inner; src/query/inet.rs)

Explicit casts

CAST(x AS t) and x::t are evaluated by the Expr::Cast arm of evaluate_row_expr. Handling by target type:

Target Behaviour
bit, bit varying Handled by a bit-string override first
vector, vector(n) pgvector parse and dimension check
bytea Hex forms decoded
interval Parsed into Value::Interval
tsvector, tsquery Canonicalised by fts::cast_text (see Full-text search)
hstore Validated
timestamp, timestamptz, date Special strings now, today, tomorrow, yesterday, epoch resolved; a date-only value becomes midnight; invalid text raises 22P02
numeric, numeric(p,s) Validated and padded to the declared scale
int2, int4, int8 Float input rounds ties to even; numeric and decimal-text input rounds ties away from zero; non-numeric text raises 22P02
boolean t, f, true, false, yes, no, on, off, 1, 0 (case-insensitive); anything else raises 22P02
real, double precision infinity, -infinity, nan accepted; out-of-range values raise an error
enum type Label must exist (invalid input value for enum)
domain type Domain checks applied
text from boolean true / false in the PostgreSQL dialect
anything else Value passed through unchanged

(source: src/query/engine.rs, Expr::Cast arm of evaluate_row_expr, cast_value_to_integer, decimal_round_to_i128, cast_value_to_date, resolve_special_datetime, pg_string_to_bool)

Not verified: a cast to uuid does not appear to validate the input text. (source: src/query/engine.rs, Expr::Cast arm)

TRY_CAST(x AS t) reaches the evaluator as the function try_cast(x, 't'); it runs the same cast and returns NULL instead of raising. (source: src/query/engine.rs, evaluate_row_expr, "try_cast" arm)

Tested by diff-corpus queries tagged cast (10 queries) and type_casts, type_literals, which compare results with PostgreSQL. (source: test-scripts/diff/corpus.py)

Date and time values

Timestamps are stored as text in the form PostgreSQL prints. The status note on timestamp text records that the stored text now matches PostgreSQL's output form. The session time zone is UTC. (source: src/query/engine.rs, coerce_assign_value_inner; docs/status/2026-11-30-timestamp-text-matches-postgres.md)

A timestamptz value written with a non-UTC offset is printed back with that offset rather than converted to the session zone, which differs from PostgreSQL. This is listed as a known gap in the status notes. (source: docs/status/2026-11-30-timestamp-text-matches-postgres.md)

now() and the other statement clock functions are covered in Functions and operators.

Network addresses

inet and cidr values are carried as text. The operators >>, >>=, << and <<= parse both sides with parse_inet and test containment for IPv4 and IPv6; mixed families never contain each other. (source: src/query/inet.rs, parse_inet, contains, inet_op)

Tested by unit tests ipv4_containment and ipv6_and_mixed_families, and by the feature-matrix scenario DDL-types/inet (round trip only). (source: src/query/inet.rs, tests; test-scripts/feature-matrix/features.py)

Vectors

vector(n) follows pgvector: values are written [1,2,3], stored as text, and parsed into Vec<f32> for distance operators. The operators and functions are listed in Functions and operators; indexing is described in HNSW and vectors. (source: src/query/pgvector.rs, parse, format, vector_typmod)

Tested by unit tests io_and_errors and ops_and_functions. (source: src/query/pgvector.rs, tests)

User-defined types

CREATE TYPE and CREATE DOMAIN store their definitions as catalog keys in the storage engine. The statement syntax is in Statements; this section covers the value semantics.

Enums

CREATE TYPE name AS ENUM ('a', 'b') stores the ordered label list. ALTER TYPE ... ADD VALUE 'x' [BEFORE | AFTER 'y'], RENAME VALUE and RENAME TO change it. Writing a value that is not a label raises invalid input value for enum. ORDER BY on an enum column follows declaration order. enum_range, enum_first and enum_last read the label list. (source: src/query/engine.rs, execute_create_type, execute_alter_type_add_value, execute_alter_type_rename_value, get_enum_values)

Tested by feature-matrix scenarios custom-types/enum-create-order (ordered comparison with PostgreSQL) and custom-types/enum-add-value. (source: test-scripts/feature-matrix/features.py)

Composite types

CREATE TYPE name AS (f1 t1, f2 t2) stores the field list. A value is built with ROW(...) and a field is read with (col).field, which the parser emits as Expr::FieldAccess. (source: src/query/engine.rs, execute_create_composite_type; src/plan/logical.rs, Expr::FieldAccess)

Tested by feature-matrix scenario custom-types/composite-field. (source: test-scripts/feature-matrix/features.py)

Range types

The built-in constructors int4range, int8range, numrange, daterange, tsrange and tstzrange take (lower, upper [, bounds]). The default bounds are [); a NULL bound is written as an empty (infinite) bound. The value is the text [lower,upper). CREATE TYPE name AS RANGE (SUBTYPE = t) records the subtype only. (source: src/query/engine.rs, eval_range_constructor, execute_create_range_type)

Range values are recognised by shape: text that starts with [ or (, ends with ] or ), and contains a comma. Operators @>, <@ and && test range containment and overlap when an operand has that shape. lower, upper, isempty, lower_inc, upper_inc, lower_inf and upper_inf read the text. (source: src/query/engine.rs, is_range_value, range_contains, ranges_overlap, range_lower, range_upper)

Differences from PostgreSQL:

  • Discrete ranges are not canonicalised. PostgreSQL returns [1,11) for int4range(1,10,'[]'); this engine returns [1,10]. (source: src/query/engine.rs, int4range arm of evaluate_row_expr)
  • The multirange constructor names (int4multirange and the others) are accepted but build a single range text, not a multirange. (source: same)
  • Because ranges are detected by shape, any text that looks like [a,b) is treated as a range by these operators. (source: src/query/engine.rs, is_range_value)

Tested by feature-matrix scenarios custom-types/range-int4-contains, range-overlap and range-lower-upper. (source: test-scripts/feature-matrix/features.py)

Domains

CREATE DOMAIN name AS base [CHECK (...)] stores the base type and check expressions. On write and on cast, a non-NULL value is tested against each check by eval_domain_check, which recognises only the form VALUE op literal with op one of >, <, >=, <=, =, !=, ~. The numeric operators compare as floats, = and != compare text, and ~ is a substring test, not a regular expression. A failing check raises value for domain ... violates check constraint (SQLSTATE 23514). (source: src/query/engine.rs, execute_create_domain, validate_domain_value, eval_domain_check)

A check in any other form (for example VALUE IN (...), length(VALUE) < 10, or a check combining two conditions with AND) is not evaluated and the value is accepted. This is a silent difference from PostgreSQL. (source: src/query/engine.rs, eval_domain_check, final true)

Tested by feature-matrix scenarios custom-types/domain-check-reject (expects 23514 for CHECK (VALUE > 0)) and domain-check-accept. (source: test-scripts/feature-matrix/features.py)