fix: guard against NULL scanTupleSlot in apply_update_list (#2537) - #2547
Open
waterWang wants to merge 2 commits into
Open
fix: guard against NULL scanTupleSlot in apply_update_list (#2537)#2547waterWang wants to merge 2 commits into
waterWang wants to merge 2 commits into
Conversation
DELETE matched relationship followed by full-path MERGE causes a PostgreSQL backend crash (signal 11, segfault) in apply_update_list at cypher_set.c:420. The scanTupleSlot in the expression context is NULL when MERGE's ON MATCH SET branch is reached after a DELETE has removed the matched edge, because the subtree's projection does not set ecxt_scantuple. Fix: check for NULL scanTupleSlot at the top of apply_update_list and return early — there is no data to update when the scan slot has not been initialized. Regression test: issue_2537 graph with the exact reproduction from the bug report (DELETE edge + CREATE + full-path MERGE).
There was a problem hiding this comment.
Pull request overview
Prevents a PostgreSQL backend crash when apply_update_list receives an uninitialized scan tuple slot.
Changes:
- Return early when
scanTupleSlotisNULL. - Add regression coverage for issue #2537.
- Record expected successful query output and graph cleanup.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/backend/executor/cypher_set.c |
Guards against a null scan tuple slot. |
regress/sql/cypher_merge.sql |
Adds the issue #2537 reproduction test. |
regress/expected/cypher_merge.out |
Adds expected regression-test output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
When a DELETE removes a matched edge before a full-path MERGE, the MERGE's ON MATCH SET branch calls apply_update_list with a NULL scanTupleSlot in the expression context, causing a PostgreSQL backend crash (signal 11, segfault).
Fix: check for NULL scanTupleSlot at the top of apply_update_list and return early — there is no data to update when the scan slot has not been initialized.
Regression test: issue_2537 graph with the exact reproduction from the bug report.
Fixes #2537