#7525·surrealdb

Behaviour difference between old planner and new for `RETURN` in where clauses.

Author: DelSkaynCreated Sep 17, 2026Updated Sep 17, 2026
Labelstopic:surrealqltopic:query planner

What component does this affect?

SurrealDB Server

Describe the bug

The new planner and the old seems to have different behaviors for a RETURN in a where clause. The new planner seems to bail out of the entire select statement and returns the value handed in return where as the old planner handles return locally within the where clause, using it's value to make a decision about what to filter.

Steps to reproduce

Run surrealdb with surrealb sql -e mem --ns t --db t and run the query SELECT a FROM [{ a: 1, a: 2}] WHERE { return a > 1 }. This should return false.

Then run surrealdb with SURREAL_PLANNER_STRATEGY=compute-only surrealdb sql -e mem -ns t --db t and run the same query, the result should be [{a: 2}]

Expected behaviour

The same output regardless of planner.

SurrealDB version

latest internal build, 3.4.0-nightly

Contact Details

Hit me up on slack.

Could this be a bug with your application?

  • I confirm this is a bug with SurrealDB, not with my own application

Is there an existing issue for this?

  • I confirm that I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct