Fix segfault in EXPLAIN with LEFT JOIN and correlated subqueries (#8548)#8556
Open
colm-mchugh wants to merge 3 commits intomainfrom
Open
Fix segfault in EXPLAIN with LEFT JOIN and correlated subqueries (#8548)#8556colm-mchugh wants to merge 3 commits intomainfrom
colm-mchugh wants to merge 3 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8556 +/- ##
==========================================
- Coverage 88.79% 88.78% -0.01%
==========================================
Files 287 287
Lines 64050 64053 +3
Branches 8054 8054
==========================================
- Hits 56874 56871 -3
- Misses 4849 4852 +3
- Partials 2327 2330 +3 🚀 New features to boost your workflow:
|
93614c1 to
b2bbdd6
Compare
Fix by adding a NULL check that skips discarded subplan entries. This is needed because PostgreSQL's setrefs.c (set_plan_references) resolves AlternativeSubPlan nodes by picking one alternative and setting the discarded subplan entries to NULL in PlannedStmt->subplans. PlanContainsDistributedSubPlanRTE() iterated this list without a NULL check, hitting the segfault reported in #8548. Also refactor the function to accept DistributedPlanningContext* instead of a raw List*, making it evident that we're iterating PostgreSQL's PlannedStmt->subplans (where NULL entries are expected). Note: PG16 errors on the test query with 'outer joins and pseudo-const quals are not supported', a known limitation with PG16. Added alternative goldfile for PG16.
b2bbdd6 to
0128473
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.
DESCRIPTION: Fix segfault in EXPLAIN with LEFT JOIN and correlated subqueries (#8548)
Fix by adding a NULL check that skips discarded subplan entries. This is needed because PostgreSQL's setrefs.c (set_plan_references) resolves AlternativeSubPlan nodes by picking one alternative and setting the discarded subplan entries to NULL in PlannedStmt->subplans. PlanContainsDistributedSubPlanRTE() iterated this list without a NULL check, hitting the segfault reported in #8548.
Also refactor the function to accept DistributedPlanningContext* instead of a raw List*, making it evident that we're iterating PostgreSQL's PlannedStmt->subplans (where NULL entries are expected).