docs: OPTIONAL CALL subqueries - #1776
Open
imilinovic wants to merge 1 commit into
Open
imilinovic wants to merge 1 commit into
imilinovic wants to merge 1 commit into
Conversation
`OPTIONAL CALL ( scope ) { body }` keeps an input row whose subquery returns no
rows, with the subquery's columns set to null - the OPTIONAL MATCH contract.
Section 2.4 said the scoped `CALL (...)` form could not be combined with
`OPTIONAL` and showed the exact query that now works. It is replaced by 1.7
under the supported uses, and 2.4 now covers the case that is still rejected:
`OPTIONAL` on a procedure call rather than on a subquery, with the subquery
wrapping that does work.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
imilinovic
marked this pull request as ready for review
September 17, 2026 12:24
imilinovic
requested review from
Josipmrden,
gitbuda and
vpavicic
as code owners
September 17, 2026 12:24
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.
Release note
OPTIONAL CALL ( scope ) { body }is now supported: an input row whose subquery returns no rows is still emitted once, with the columns the subquery returns set tonull— theOPTIONAL MATCHcontract. Documented as a new section under the supported uses ofCALL, replacing the section that said the scoped form could not be combined withOPTIONAL.Related product PRs
PRs from product repo this doc page is related to:
memgraph/memgraph#4833
Checklist:
bugfixorfeaturelabel, based on the product PR type you're documentingWhat changed on the page
OPTIONAL CALLunder the supported uses: the contract, a worked example, and the two thingsOPTIONALdoes not change (imported variables keep their values; a unit subquery has no columns to null).OPTIONAL CALLwith scoped variables" and stated that the scoped form cannot be combined withOPTIONAL, showing the exact query this PR makes work. It now covers what is still rejected —OPTIONALon a procedure call — with the subquery wrapping that works instead.Every query and output in the new section was run against the branch build.