From 3151f16e1874db82ed85a005dac15368903ca9fb Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Wed, 23 Mar 2016 12:28:01 -0400 Subject: 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. --- contrib/postgres_fdw/postgres_fdw.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'contrib/postgres_fdw/postgres_fdw.c') diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 9600e3b3c45..f21689e73d1 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -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; -- cgit v1.2.3