Details
-
Bug
-
Resolution: Not a Bug
-
Major
-
Cheshire-Cat
-
None
-
Untriaged
-
1
-
Unknown
Description
For a MERGE statement, UPDATE and DELETE actions can be specified with WHEN MATCHED clause. Current there is no restriction as to whether both UPDATE and DELETE actions can be specified for the same MERGE statement. For example:
MERGE INTO shellTest t
|
USING shellTest s ON t.c21 = s.c11
|
WHEN MATCHED THEN UPDATE set t.c22 = t.c23 unset t.c23 WHERE t.type = "target" AND t.c23 IS NOT MISSING |
WHEN MATCHED THEN DELETE WHERE t.type = "target" AND t.inserted = true |
This statement is currently supported, i.e. there is no check to forbid such a statement. A potential issue with this is that the same document could potentially go through both the UPDATE and the DELETE action, and thus potentially be returned to the user twice (if a RETURNING clause is used), which is semantically incorrect.
We need to do a competitive analysis on how MERGE statement is supported in other databases and come up with a recommendation as to how this should be resolved in Couchbase.
Attachments
Issue Links
- relates to
-
MB-41009 Merge statement when matched semantic changes
- Closed