Skip to content

docs: OPTIONAL CALL subqueries - #1776

Open
imilinovic wants to merge 1 commit into
release/3.14from
docs/optional-call-subquery
Open

imilinovic wants to merge 1 commit into
release/3.14from
docs/optional-call-subquery

Conversation

@imilinovic

Copy link
Copy Markdown
Contributor

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 to null — the OPTIONAL MATCH contract. Documented as a new section under the supported uses of CALL, replacing the section that said the scoped form could not be combined with OPTIONAL.

Related product PRs

PRs from product repo this doc page is related to:
memgraph/memgraph#4833

Checklist:

  • Add appropriate milestone (current release cycle)
  • Add bugfix or feature label, based on the product PR type you're documenting
  • Make sure all relevant tech details are documented
  • Check all content with Grammarly
  • Perform a self-review of my code
  • The build passes locally
  • My changes generate no new warnings or errors

What changed on the page

  • New 1.7. Optional subqueries with OPTIONAL CALL under the supported uses: the contract, a worked example, and the two things OPTIONAL does not change (imported variables keep their values; a unit subquery has no columns to null).
  • 2.4 previously read "Using OPTIONAL CALL with scoped variables" and stated that the scoped form cannot be combined with OPTIONAL, showing the exact query this PR makes work. It now covers what is still rejected — OPTIONAL on a procedure call — with the subquery wrapping that works instead.

Every query and output in the new section was run against the branch build.

`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.
@imilinovic imilinovic added this to the 3.14 milestone Sep 17, 2026
@imilinovic imilinovic added the feature Documentation related to a new product feature of feature update label Sep 17, 2026
@imilinovic imilinovic self-assigned this Sep 17, 2026
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
documentation Ready Ready Preview Sep 17, 2026 12:05pm UTC

Request Review

@imilinovic imilinovic changed the title Document OPTIONAL CALL subqueries docs: OPTIONAL CALL subqueries Sep 17, 2026
@imilinovic
imilinovic marked this pull request as ready for review September 17, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Documentation related to a new product feature of feature update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant