Types
PowerSync sync rules use the SQLite type system.
The supported types are:
null
integer
: a 64-bit signed integerreal
: a 64-bit floating point numbertext
: An UTF-8 text stringblob
: Binary data
Binary 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 |
|
float4, float8 | real | |
enum | text | |
uuid | text | |
timestamptz | text | Format: |
timestamp | text | Format: |
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.
Last updated