Here are some known bugs and issues with SurrealDB.
IF EXISTS and IF NOT EXISTS are not yet available in the DEFINE statementSome query functionality is not yet available in the SDKs. Such as IF EXISTS and IF NOT EXISTS clauses in the DEFINE statement. This means that if you used these clauses in your query method (as seen in the example below), the SDK would not be able to parse the query correctly.
await db.query( 'DEFINE FIELD IF NOT EXISTS email ON TABLE user TYPE string;' );
When using a pre-2.0 version of the Rust SDK, the sql2 feature flag can be enabled to allow it to recognize newer syntax.
DELETE ONLY always returns an errorIn the DELETE statement the ONLY clause doesn’t work as expected because it checks for a length of 1 and DELETE doesn’t return anything by default at this time. So it always gives the following error:
However, adding RETURN $before will force DELETE to return the deleted record, which will be the expected length of 1.
CREATE person:one; // Currently fails DELETE ONLY person:one; // Workaround: add RETURN $before DELETE ONLY person:one RETURN $before;