This page is a formal grammar reference for Sync Streams: it shows the syntax the compiler accepts 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 rules nest (e.g. subqueries, CTEs, JOINs), 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 Writing Queries.Documentation Index
Fetch the complete documentation index at: https://docs.powersync.com/llms.txt
Use this file to discover all available pages before exploring further.
SelectStatement
SelectItem
Used by
Used by
Reference
Used by
Used by
FromSource
Used by
Used by
TableSource
Used by
Used by
TableValuedCall
Used by
Used by
TableValuedSource
Used by
Used by
SubquerySource
Used by
Used by
JoinClause
Used by
Used by
WhereClause
Used by
Used by
Condition
Used by
Used by
PredicateTail
Used by
Used by
InSource
Used by
Used by
Expression
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.
| Precedence | Operators | Description |
|---|---|---|
| 1 | || | String concatenation |
| 2 | * / % | Multiplication, division, modulo |
| 3 | + - | Addition, subtraction |
| 4 | & | << >> | Bitwise AND, OR, left/right shift |
| 5 | < > <= >= | Less than, greater than, etc. |
| 6 | = != | Equal, not equal |
Used by
Used by
PropertyAccess
Used by
Used by
PrimaryExpression
Used by
Used by
CaseExpression
Used by
Used by
SearchedCase
Used by
Used by
WhenClause
Used by
Used by
CaseCondition
Used by
Used by
SimpleCase
Used by
Used by
WhenValueClause
Used by
Used by
CastExpression
Used by
Used by
FunctionCall
Used by
Used by
Subquery
Used by
Used by
CteDefinition
Lexical Rules
| Token | Examples | Rule |
|---|---|---|
| Identifier | user_id, MY_TABLE, "Column Name", "with ""quotes"" inside" | [A-Z_] ([A-Z_0-9])* |
| StringLiteral | 'hello', 'it''s', '' | "'" ([\x20-\x26] | [\x28-\x7E])* "'" |
| IntegerLiteral | 0, 42, 12345 | ([0-9])+ |
| NumericLiteral | 3.14, 42, 0.5 | ([0-9])+ ("." ([0-9])+)? |
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 ("").Used by
Used by
StringLiteral
Single-quoted string literal. Embedded single quotes are escaped by doubling them (”).Used by
Used by
IntegerLiteral
One or more decimal digits (0-9).Used by
Used by
NumericLiteral
Decimal number: one or more digits with an optional fractional part (.digits).Used by
Used by