Does delete SQL query work with a CTE or WITH clause in couchbase?
I get this error :
Syntax error at: DELETE (reserved word)
My code:
WITH inactiveDocs AS
(
SELECT META(d).id
FROM example_bucket d
WHERE d.status = "inactive"
)
DELETE FROM example_bucket d
WHERE META(d).id IN (SELECT RAW id FROM inactiveDocs);
Does delete SQL query work with a CTE or WITH clause in couchbase?
Couchbase does not support the use of WITH
statements in any context other than SELECT
statements; this is delineated very clearly in their documentation for WITH
:
The
WITH
clause can only be used preceding aSELECT
statement [...]
Notably, this differs from some of Couchbase's more traditional RDBMS counterparts like SQL Server/T-SQL, MySQL, and PostgreSQL, just to name a few.