docs: cqn4sql path expression transformations - #1558
Open
patricebender wants to merge 2 commits into
Open
Conversation
patricebender
requested review from
BobdenOs,
danjoa,
johannes-vogel,
sjvans and
stewsk
as code owners
March 30, 2026 09:49
BobdenOs
approved these changes
Apr 22, 2026
stewsk
reviewed
Apr 22, 2026
|
|
||
| ### FK shortcut — no join needed | ||
|
|
||
| If the path accesses only a foreign key field (or the association itself without further navigation), no join is generated: |
Contributor
There was a problem hiding this comment.
clarify: what if also another field is accessed via the assoc?
stewsk
reviewed
Apr 22, 2026
| { author.name as author_name } | ||
| ``` | ||
|
|
||
| The same association with **different filters** (or with/without a filter) produces **separate joins** with unique aliases: |
Member
Author
There was a problem hiding this comment.
→ the same association once with a filter and once without a filter produce separate joins
stewsk
reviewed
Apr 22, 2026
| } | ||
| ``` | ||
|
|
||
| Infix filters also apply in `exists` and `FROM` navigation, where they become conditions in the `WHERE EXISTS` subquery. |
Contributor
There was a problem hiding this comment.
Suggested change
| Infix filters also apply in `exists` and `FROM` navigation, where they become conditions in the `WHERE EXISTS` subquery. | |
| Infix filters also can occur in `exists` and `FROM` navigation, where they become conditions in the `WHERE EXISTS` subquery. |
|
|
||
| ## 3. WHERE EXISTS Subqueries | ||
|
|
||
| Both association paths in `FROM` and the `exists` predicate produce `WHERE EXISTS` correlated subqueries. The mechanics are the same — a `FROM` path like `Authors:books` is semantically equivalent to `SELECT from Books where exists author`. |
Contributor
There was a problem hiding this comment.
Suggested change
| Both association paths in `FROM` and the `exists` predicate produce `WHERE EXISTS` correlated subqueries. The mechanics are the same — a `FROM` path like `Authors:books` is semantically equivalent to `SELECT from Books where exists author`. | |
| Association paths both in `FROM` and in an `exists` predicate produce `WHERE EXISTS` correlated subqueries. The mechanics are the same — a `FROM` path like `Authors:books` is semantically equivalent to `SELECT from Books where exists author`. |
|
|
||
| ### Association in FROM | ||
|
|
||
| An association step in the `FROM` clause rewrites the query target to the association's target entity and adds a `WHERE EXISTS` subquery correlating back to the source: |
Contributor
There was a problem hiding this comment.
Suggested change
| An association step in the `FROM` clause rewrites the query target to the association's target entity and adds a `WHERE EXISTS` subquery correlating back to the source: | |
| An association step in the `FROM` clause moves the query target to the association's target entity and adds a `WHERE EXISTS` subquery correlating back to the source: |
stewsk
approved these changes
Apr 22, 2026
patricebender
force-pushed
the
patrice/cqn4sql-doc
branch
from
April 29, 2026 12:56
d7f6b88 to
54d2837
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
a2j): enable path expression inside filter #1361