Skip to main content

Syntax, names and literals

The SQL reference distinguishes executable queries from grammar-only statements. The checked syntax owner is TransitExtensions.g4. Application declarations have their own grammar and bounds. See data types and cell states for type coverage and functions and operators for expression support.

Reading the syntax​

In syntax blocks, uppercase words and punctuation are literal SQL. Lowercase names such as source stand for values supplied by the caller. Square brackets mean optional text, | separates alternatives, and ... repeats the preceding item. These markers are notation, not characters to type. Examples ending in a semicolon are complete statements unless explicitly labeled as fragments.

The query grammar accepts one statement and an optional final semicolon. Extra statements and trailing tokens reject. Keywords are case-insensitive. Whitespace, -- line comments and nested /* ... */ comments can separate tokens.

Names​

Unquoted names start with an ASCII letter or underscore and continue with ASCII letters, digits or underscores. They fold to lowercase. Double quotes preserve case; a doubled double quote is the grammar's escape inside a quoted identifier. Reserved keywords need quotes when used as names.

The Fuze compiler additionally requires every decoded name to be a valid ASCII identifier of at most 16 bytes. Quoting does not admit spaces, punctuation or longer names into an executable query. Reference-grammar acceptance alone does not enforce these production bounds.

source.column qualifies a column with the exact declared source name. With FROM source AS alias, use alias.column instead; the source name remains the identity to resolve, while the alias supplies its query-local qualifier. AS is required. The compiler performs no schema, namespace or catalog lookup. The restricted aggregate subquery has a separate outer alias; an inner source alias does not escape that subquery.

column AS name, either COUNT form with AS name, and SUM(column) AS name name result columns. These names use the same identifier rules and must be distinct within the output schema. They do not enter WHERE scope. A renamed inner projection is visible to the outer aggregate in the restricted subquery form.

Query literals​

FormExampleMeaning
Signed decimal integer-42, +7, 0int64, from -9223372036854775808 through 9223372036854775807
BooleanTRUE, FALSEBoolean value
NullNULLExplicit null; use IS NULL
String'it''s ready'UTF-8 text; doubled single quotes encode a quote
Binary'\x00ff'::byteaHexadecimal bytes
Unsigned integer'18446744073709551615'::uint64Decimal digits; 0 through 18446744073709551615
Floating point'-0.0'::float64, '1.25e2'::float64Finite IEEE 754 double; negative zero is preserved

Backslashes are literal, including the \x prefix decoded by the binary literal handler. Numeric type suffixes apply only to string literals: uint64 accepts decimal digits without signs; float64 accepts decimal notation with an optional sign, decimal point and exponent. Non-finite values, overflow, whitespace and underscores reject. Float conversion rounds to binary64. E strings, dollar quoting, adjacent-string concatenation, bare fractional literals, implicit casts and general expressions are unsupported.

For declared uint64 counter and float64 fraction columns:

SELECT counter FROM items WHERE counter = '18446744073709551615'::uint64;
SELECT fraction FROM items WHERE fraction >= '-0.0'::float64;

LIMIT accepts unsigned decimal digits without a sign. Its allowed value is 0–18446744073709551615. No limit means no implicit truncation; finite execution budgets still apply.

Administrative options and types​

The grammar-only connector statements use a nonempty parenthesized list:

(option = 'value' [, option = 'value' | option = SECRET('reference') ...])

Each value is a string or SECRET('reference'); numbers and booleans must be quoted here. Keys and connector kinds are identifiers. Grammar acceptance does not validate option names, duplicates, a connector's configuration or a secret binding. SECRET names a credential reference; it does not carry resolved bytes. See CREATE CONNECTION.

The declared types for CREATE TABLE and CREATE KV are INT64, BOOL, UTF8 and BINARY. These tokens do not imply SQL provisioning support or encode every type in a unified query schema.

Query bounds and rejection​

The production parser accepts at most 4096 UTF-8 bytes, 16-byte identifiers, 16 levels of block comments and 220 bytes per decoded literal cell. It rejects NUL, malformed UTF-8, unterminated tokens and out-of-range integers. The AST holds at most eight explicit projected columns and a predicate of at most 64 instructions. Pending Boolean operators and group delimiters share a 64-entry stack. AND, OR and NOT are reserved words; quote them when used as identifiers. Durable queries have finite plan upload and execution budgets.

These are per-operation bounds, independent of source cardinality. A syntactically valid query may still fail name/type checking, authorization or execution. See SELECT failures and the compiler reference.