Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SEGV on query with Left Outer Join (#7787) #7789

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/backend/distributed/planner/query_pushdown_planning.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,6 +2049,16 @@ CreateSubqueryTargetListAndAdjustVars(List *columnList)
*/
column->varno = 1;
column->varattno = resNo;

/*
* 1 subquery means there is one range table entry so with Postgres 16+ we need
* to ensure that column's varnullingrels - the set of join rels that can null
* the var - is empty. Otherwise, when given the query, the Postgres planner
* may attempt to access a non-existent range table and segfault, as in #7787.
*/
#if PG_VERSION_NUM >= PG_VERSION_16
column->varnullingrels = NULL;
#endif
}

return subqueryTargetEntryList;
Expand Down
Loading
Loading