Overview

Scalar types#

Neutral type Category
bool Boolean
int16, int32, int64 Integer widths
float32, float64 Floating point
string Text
bytes Binary
uuid UUID
decimal Arbitrary-precision numeric
date Calendar date
time, time_tz Time of day, with/without zone
datetime, datetime_tz Timestamp, with/without zone
interval Duration
json JSON document
inet Network address

Each scalar maps consistently across every backend language — Rust (sqlx/tokio-postgres), Python, TypeScript, Go, Java, Kotlin, C#, Elixir, and Ruby — with small variations based on what each language's type system and driver actually support.

Container types#

Neutral type Meaning
array<T> Generic array of neutral type T
nullable Optional/nullable wrapper
range<T> Range type over T (PostgreSQL range types)
json_typed<T> Typed JSON from a @json annotation
json_nested<T> Structured JSON synthesized from an aggregation function

Java and Kotlin map array<T> to String due to driver limitations with untyped array accessors — this is a known constraint of those two JDBC-based backends, not a scythe limitation elsewhere.

Special types#

Neutral type Meaning
enum::name A user-defined PostgreSQL enum, converted to PascalCase in generated code
composite::name A user-defined PostgreSQL composite type, converted to PascalCase

See the composite type decoding limitation for which backends actually parse composite::name values at runtime versus just declaring the type.

Dialect-specific exceptions#

A handful of SQL-to-neutral mappings vary by database engine rather than following the general PostgreSQL-derived table:

  • INTEGER maps to int64 (not int32) on SQLite and Snowflake, because neither engine exposes a narrower integer class to select from.
  • Bare FLOAT maps to float32 on MySQL specifically; every other engine maps it to float64.
  • ENUM(...) maps to enum::{table}_{column} on MySQL and SQLite (both lack a standalone named-enum-type concept); elsewhere it maps to plain string.
  • BIT(n) where n > 1 maps to int64 on MySQL; on every other engine it maps to bytes.
  • Type Inference — how nullability wraps around these base types.
  • Custom Types — overriding what a SQL type resolves to at the neutral-type step.
  • Database Support — the full PostgreSQL SQL-type-to-neutral-type table.

Updated

Was this page helpful?