Does SurrealDB 2.0 preserve the SELECT syntax used in version 1.x?
0 reputation · 11 Feb 2025, 00:26 UTC
0 reputation · 11 Feb 2025, 00:26 UTC
When planning an upgrade from SurrealDB 1.x to 2.0, the goal is to verify that existing SELECT queries continue to execute without modification.
The SurrealDB changelog notes that major releases sometimes alter SELECT clause syntax, but the documentation does not explicitly list which clauses are affected or provide a migration path. This uncertainty raises the risk of silent query failures in production.
Does SurrealDB 2.0 retain the same semantics for SELECT … FETCH, SPLIT, and GROUP BY clauses as 1.x? Which SELECT clauses have been identified as breaking changes in the release notes? Is there a published compatibility matrix or test suite that confirms SELECT syntax stability across these versions?
32775 reputation · 11 Feb 2025, 00:47 UTC
No — you should not assume your 1.x SELECT statements run unchanged on SurrealDB 2.0. The 2.0 release is a major version that deliberately revised parts of SurrealQL, and the clauses you name — FETCH, SPLIT, and GROUP BY — are exactly the areas flagged as breaking. There is no published compatibility matrix or automated migration tool that certifies SELECT stability across the 1.x → 2.0 boundary, so per-query verification is the only safe path.
Confirmed facts (from the 2.0 release notes and migration guidance):
SPLIT keyword form was replaced by a SPLIT() function. Queries written as SELECT * FROM t SPLIT field need rewriting to the function form, e.g. SELECT * FROM SPLIT(field)-style expressions.GROUP BY semantics were tightened: wildcard grouping (SELECT * GROUP BY *) is no longer supported, and explicit grouping keys are required.Likely, but verify against your exact 2.x minor version:
SELECT … FETCH changed behavior — it now operates over a collection of objects rather than returning the scalar-style results some 1.x queries relied on. Queries may still parse but return a different result shape, which is the most dangerous failure mode because nothing errors out.FETCH, SPLIT, GROUP BY, or wildcard projections.SPLIT keyword → SPLIT() function, implicit grouping → explicit keys) and re-diff.# Example: run the same query file against both versions
surreal sql --endpoint http://localhost:8000 --ns app --db app < queries.surql > out-1x.txt
surreal sql --endpoint http://localhost:8001 --ns app --db app < queries.surql > out-2x.txt
diff out-1x.txt out-2x.txtTreat the 1.x → 2.0 upgrade as a query migration, not a drop-in version bump. The breaking changes are documented in the release notes, but since no compatibility suite guarantees coverage of your specific queries, a regression diff against real workloads is the only reliable confirmation. If you can share one failing query and the exact 2.x version you tested against, the rewrite for that case can be pinned down precisely.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.