Types
PowerSync sync rules uses the SQLite type system.
The supported types are:
- 1.null
- 2.integer: a 64-bit signed integer
- 3.real: a 64-bit floating point number
- 4.text: An UTF-8 text string
- 5.blob: Binary data
BLOB data can be accessed in sync rules, but cannot be synced directly to clients, 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 | string | |
bool | integer | 1 for true, 0 for false |
float4, float8 | real | |
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 PostgreSQL. |
timestamp | text | Format: YYYY-MM-DD hh:mm:ss.sss
In most cases, timestamptz should be used instead. |
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 | |
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 modified 3d ago