PowerSync’s Sync Rules use the SQLite type system.
The supported client-side SQLite types are:
null
integer
: a 64-bit signed integerreal
: a 64-bit floating point numbertext
: An UTF-8 text stringblob
: Binary dataBinary data in Postgres can be accessed in Sync Rules, but cannot be synced directly to clients (it needs to be converted to hex or base64 first — see below), and cannot be used as bucket parameters.
Postgres values are mapped according to this table:
Postgres Data Type | PowerSync / SQLite Column Type | Notes |
---|---|---|
text, varchar | text | |
int2, int4, int8 | integer | |
numeric / decimal | text | These types have arbitrary precision in Postgres, so can only be represented accurately as text in SQLite |
bool | integer | 1 for true, 0 for false |
float4, float8 | real | |
enum | text | |
uuid | text | |
timestamptz | text | Format: YYYY-MM-DD hh:mm:ss.sssZ . This is compatible with ISO8601 and SQLite’s functions. Precision matches the precision used in Postgres. -infinity becomes 0000-01-01 00:00:00Z and infinity becomes 9999-12-31 23:59:59Z . |
timestamp | text | Format: YYYY-MM-DD hh:mm:ss.sss . In most cases, timestamptz should be used instead. -infinity becomes 0000-01-01 00:00:00 and infinity becomes 9999-12-31 23:59:59 . |
date, time | text | |
json, jsonb | text | There is no dedicated JSON type — JSON functions operate directly on text values. |
interval | text | |
macaddr | text | |
inet | text | |
bytea | blob | Cannot sync directly to client — convert to hex or base64 first. See Operators & Functions. |
geometry (PostGIS) | text | hex string of the binary data Use the ST functions to convert to other formats |
There is no dedicated boolean data type. Boolean values are represented as 1
(true) or 0
(false).
json
and jsonb
values are treated as text
values in their serialized representation. JSON functions and operators operate directly on these text
values.
BSON Type | PowerSync / SQLite Column Type | Notes |
---|---|---|
String | text | |
Int, Long | integer | |
Double | real | |
Decimal128 | text | |
Object | text | Converted to a JSON string |
Array | text | Converted to a JSON string |
ObjectId | text | Lower-case hex string |
UUID | text | Lower-case hex string |
Boolean | integer | 1 for true, 0 for false |
Date | text | Format: YYYY-MM-DD hh:mm:ss.sss |
Null | null | |
Binary | blob | Cannot sync directly to client — convert to hex or base64 first. See Operators & Functions. |
Regular Expression | text | JSON text in the format {"pattern":"...","options":"..."} |
Timestamp | integer | Converted to a 64-bit integer |
Undefined | null | |
DBPointer | text | JSON text in the format {"collection":"...","oid":"...","db":"...","fields":...} |
JavaScript | text | JSON text in the format {"code": "...", "scope": ...} |
Symbol | text | |
MinKey, MaxKey | null |
ObjectId
, Date
, UUID
are all converted to a plain TEXT
column.This section is a work in progress. More details for MySQL connections are coming soon. In the meantime, ask on our Discord server if you have any questions.