Skip to content

Type Reference

Synchro maps PostgreSQL column types to a logical type system, which client SDKs then map to their local storage (SQLite on mobile).

PostgreSQL TypeLogical TypeSQLite TypeNotes
uuidstringTEXT
text, varchar, charstringTEXTIncludes character varying(n), character(n)
integer, smallintintINTEGERIncludes serial, smallserial
bigintint64INTEGERIncludes bigserial
real, double precisionfloatREAL
numeric, decimalfloatREALIncludes numeric(p,s), decimal(p,s)
booleanbooleanINTEGER0 / 1
timestamp with time zonedatetimeTEXTISO 8601 format
timestamp without time zonedatetimeTEXTISO 8601 format
datedateTEXTYYYY-MM-DD
time without time zonetimeTEXTHH:MM:SS
time with time zonetimeTEXTHH:MM:SS+offset
json, jsonbjsonTEXTSerialized JSON string
byteabytesBLOB
intervalstringTEXTPostgreSQL interval string representation
tsvectorstringTEXTFull-text search vector as string
ltreestringTEXTLabel tree path as string
PostgreSQL TypeLogical TypeSQLite TypeNotes
text[], varchar[]jsonTEXTSerialized as JSON array
integer[], bigint[]jsonTEXTSerialized as JSON array
uuid[]jsonTEXTSerialized as JSON array
Any type with [] suffixjsonTEXTAll arrays serialize to JSON
PostgreSQL TypeLogical TypeSQLite TypeNotes
User-defined enumsstringTEXTStored as string value
Domains(base type)(base type)Resolved to underlying type
halfvec(n)stringTEXTpgvector half-precision vector

These PostgreSQL types are not supported for sync. Using them on a synced table will produce an error at schema load time.

Type CategoryExamplesReason
Geometricpoint, line, polygon, circleNo mobile equivalent
Networkinet, cidr, macaddrNot applicable to mobile sync
CompositeUser-defined composite typesComplex nested structure
Bit stringsbit, bit varyingRarely used in application tables
XMLxmlUse json/jsonb instead
Rangeint4range, tsrange, daterangeNo SQLite equivalent

  1. Composite primary keys are not supported. Each synced table must have a single-column primary key. UUID is recommended.
  2. Primary keys are always synced and cannot be listed in ProtectedColumns.
  1. numeric/decimal maps to float, which means values are stored as REAL in SQLite. Floating-point precision loss may occur for values exceeding 15-17 significant digits. If exact decimal precision is critical, consider storing values as text and parsing in the application layer.
  1. Timestamp precision: SQLite stores timestamps as TEXT in ISO 8601 format. Sub-second precision depends on client SDK parsing.
  2. Timezone handling: Both timestamp with time zone and timestamp without time zone map to the same datetime logical type. The server normalizes to UTC.
  1. Stored as INTEGER (0/1) on the client. Client SDKs handle the conversion transparently.
  1. Stored as TEXT on the client. No binary UUID optimization is applied.
  1. Enum values are not enforced client-side. The client stores the string value and can write any string. The server validates enum membership on push, rejecting invalid values.
  1. Generated columns (PostgreSQL 12+): Server-computed values may not round-trip correctly. The generated expression is not replicated to the client.
  2. Partitioned tables: Not tested with logical replication or the schema introspection queries.

Not all PostgreSQL defaults can be replicated to SQLite. The schema endpoint classifies each default and provides a SQLite-compatible expression where possible.

KindMeaning
noneColumn has no default
portableDefault can be applied on the client
server_onlyDefault only applies on the server; omitted on client
Default KindExamplePortable?Client Behavior
NULLDEFAULT NULLYesApplied locally
Literal numberDEFAULT 0, DEFAULT 3.14YesApplied locally
Literal stringDEFAULT 'active'YesApplied locally
Boolean literalDEFAULT true, DEFAULT falseYesMapped to 1/0
JSON literalDEFAULT '{}'::jsonbYesCast stripped, literal preserved
CURRENT_TIMESTAMPDEFAULT CURRENT_TIMESTAMPYesSQLite CURRENT_TIMESTAMP
CURRENT_DATEDEFAULT CURRENT_DATEYesSQLite CURRENT_DATE
CURRENT_TIMEDEFAULT CURRENT_TIMEYesSQLite CURRENT_TIME
now()DEFAULT now()YesMapped to CURRENT_TIMESTAMP
Function callDEFAULT gen_random_uuid()NoServer-only, omitted locally
SequenceDEFAULT nextval(...)NoServer-only, omitted locally
ExpressionDEFAULT (now() + interval '30 days')NoServer-only, omitted locally

The /sync/schema endpoint returns default_kind and sqlite_default_sql for each column:

{
"name": "created_at",
"db_type": "timestamp with time zone",
"logical_type": "datetime",
"nullable": false,
"default_sql": "now()",
"default_kind": "portable",
"sqlite_default_sql": "CURRENT_TIMESTAMP",
"is_primary_key": false
}

ConstraintServerClientNotes
PRIMARY KEYEnforcedEnforcedSingle-column only
NOT NULLEnforcedReplicatedApplied to client schema
UNIQUEEnforcedSingle-column onlyMulti-column unique not replicated
FOREIGN KEYEnforcedNot enforcedClient is a cache; FK integrity maintained by server
CHECKEnforcedNot enforcedServer validates on push
DEFAULTEnforcedPortable onlySee portability matrix above

Columns listed in ProtectedColumns on a TableConfig are excluded from client writes (push). The server ignores values for these columns in push payloads. Common uses:

  • Server-computed columns (created_at, updated_at)
  • Ownership columns (user_id) that the server sets from the authenticated identity
  • Derived or aggregated values

The system columns id, created_at, updated_at, and deleted_at are always protected implicitly, along with the configured owner column.