Skip to main content
This page is a formal grammar reference for Sync Rules: it shows the syntax accepted for parameter queries and data queries using railroad diagrams. This page complements the Supported SQL guide, which explains in prose what you can write, with examples and restrictions. When to use this page: If you need to check whether a construct is valid, see how parameter vs data query syntax differs, or you’re used to grammar specs, use the diagrams and the “Used by” / “References” links to navigate. For most users just getting started, see Supported SQL and the Sync Rules docs.

ParameterQuery

ParameterQuery syntax diagram References: StaticParameterQuery, TableParameterQuery, TableValuedParameterQuery

TableValuedParameterQuery

TableValuedParameterQuery syntax diagram References: Identifier, JsonEachCall, SelectItem, WhereClause

TableParameterQuery

TableParameterQuery syntax diagram References: Reference, SelectItem, WhereClause

StaticParameterQuery

StaticParameterQuery syntax diagram References: SelectItem, WhereClause

DataQuery

DataQuery syntax diagram References: Reference, SelectItem, WhereClause

SelectItem

SelectItem syntax diagram References: Expression, Identifier

JsonEachCall

JsonEachCall syntax diagram References: Expression

WhereClause

WhereClause syntax diagram References: Predicate, WhereClause

Predicate

Predicate syntax diagram References: Expression

Expression

Expression syntax diagram

Operators

Binary operators supported in scalar expressions, listed from highest to lowest precedence.
PowerSync evaluates all binary operators with equal precedence (left to right). Use parentheses to control evaluation order.
References: PrimaryExpression, PropertyAccess

PropertyAccess

PropertyAccess syntax diagram References: IntegerLiteral, StringLiteral

Reference

Reference syntax diagram References: Identifier

CastExpression

CastExpression syntax diagram References: Expression

FunctionCall

FunctionCall syntax diagram References: Expression, Reference

PrimaryExpression

PrimaryExpression syntax diagram References: CastExpression, Expression, FunctionCall, NumericLiteral, Reference, StringLiteral

Lexical Rules

Identifier

Bare identifiers are normalized to lower case and may contain letters, digits, and underscores. Double-quoted identifiers (“name”) allow any printable character and support escaped quotes ("").

StringLiteral

Single-quoted string literal. Embedded single quotes are escaped by doubling them (”).

IntegerLiteral

One or more decimal digits (0-9).

NumericLiteral

Decimal number: one or more digits with an optional fractional part (.digits).