Re: Getting sorted data from foreign server for merge join - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Getting sorted data from foreign server for merge join
Date
Msg-id CA+Tgmobm6ugnA2mqayG8FQUVBsrU7i4kuYX=wAUd92VK7m+kMw@mail.gmail.com
Whole thread Raw
In response to Re: Getting sorted data from foreign server for merge join  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
On Thu, Jan 7, 2016 at 4:05 AM, Ashutosh Bapat
<ashutosh.bapat@enterprisedb.com> wrote:
> In get_useful_ecs_for_relation(), while checking whether to use left or
> right argument of a mergejoinable operator, the arguments to bms_is_subset()
> are passed in reverse order. bms_is_subset() checks whether the first
> argument in subset of the second, but in this function the subset to be
> checked is passed as the second argument. Because of this following query
> when run in contrib_regression database after "make installcheck" in
> contrib/postgres_fdw trips assertion Assert(bms_is_subset(relids,
> restrictinfo->left_ec->ec_relids));
>
> EXPLAIN (COSTS false, VERBOSE)
>     SELECT t1."C 1" FROM "S 1"."T 1" t1 left join ft1 t2 join ft2 t3 on
> (t2.c1 = t3.c1) on (t3.c1 = t1."C 1") OFFSET 100 LIMIT 10;
>
> PFA patch to fix it.

The test case failed for me, possibly because of Tom's upper planner
pathification, but the substantive part of the fix looks right to me,
so committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: Optimizer questions
Next
From: Robert Haas
Date:
Subject: Re: Pushing down sorted joins