Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/testing/semantic-coverage-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,17 @@ unit 944/944; functional clean):
Added a mirror rule chaining four `make_label_expr` conjuncts. Repeated labels
are harmless — each conjunct is an independent EXISTS check. No bison conflicts
(still `%expect 15` / `%expect-rr 3`).

## Coverage update (2026-05-28) — existential subquery brace form (no inner WHERE)

`cypher_gram.y`. Verified via the TCK harness (3708 -> 3710, zero regressions;
unit 944/944; functional clean):

- **`WHERE exists { (n)-->() }` parses and evaluates** (ExistentialSubquery1
[1]/[3]). Added `EXISTS '{' pattern_list '}'` reusing the existing
`EXISTS_TYPE_PATTERN` transform, which already resolves correlated outer
variables (the bound `n`) via its outer-alias lookup and emits a correlated
`EXISTS (SELECT 1 FROM ... WHERE ...)` subquery. No bison conflicts (still
`%expect 15` / `%expect-rr 3`). The brace form **with** an inner `WHERE`
([2]/[4]) and the full-query/aggregation/nested forms (ExistentialSubquery2/3)
remain unsupported — they need inner-variable registration and are deferred.
8 changes: 8 additions & 0 deletions src/backend/parser/cypher_gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,14 @@ function_call:
/* EXISTS((pattern)) - check for relationship/path existence */
$$ = (ast_node*)make_exists_pattern_expr($3, @1.first_line);
}
| EXISTS '{' pattern_list '}'
{
/* Existential subquery brace form: EXISTS { (n)-->() }
* (ExistentialSubquery1 [1]/[3]). Reuses the pattern-existence
* transform; correlated outer variables resolve via the
* EXISTS_TYPE_PATTERN emitter's outer-alias lookup. */
$$ = (ast_node*)make_exists_pattern_expr($3, @1.first_line);
}
| EXISTS '(' IDENTIFIER '.' IDENTIFIER ')'
{
/* EXISTS(n.property) - unambiguous property existence check */
Expand Down
Loading