1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

postgres_fdw: Fix crash when pushing down multiple joins.

A join clause might mention multiple relations on either side, so it
need not be the case that a given joinrel's constituent relations are
all on one side of the join clause or all on the other.

Report by Rajkumar Raghuwanshi.  Analysis and fix by Michael Paquier
and Ashutosh Bapat.
This commit is contained in:
Robert Haas
2016-03-23 12:28:01 -04:00
parent 44ca4022f3
commit 3151f16e18
3 changed files with 289 additions and 4 deletions

View File

@ -727,12 +727,9 @@ get_useful_ecs_for_relation(PlannerInfo *root, RelOptInfo *rel)
if (bms_is_subset(relids, restrictinfo->right_ec->ec_relids))
useful_eclass_list = list_append_unique_ptr(useful_eclass_list,
restrictinfo->right_ec);
else
{
Assert(bms_is_subset(relids, restrictinfo->left_ec->ec_relids));
else if (bms_is_subset(relids, restrictinfo->left_ec->ec_relids))
useful_eclass_list = list_append_unique_ptr(useful_eclass_list,
restrictinfo->left_ec);
}
}
return useful_eclass_list;