Re: postgres_fdw bug in 9.6

Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>

From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Jeff Janes <jeff.janes@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-01-05T02:50:25Z
Lists: pgsql-hackers
On 2016/12/27 16:41, Etsuro Fujita wrote:
> On 2016/12/22 1:04, Ashutosh Bapat wrote:
>> 2. We should try to look for other not-so-cheap paths if the cheapest
>> one is
>> paramterized. You might want to use get_cheapest_path_for_pathkeys()
>> to find a
>> suitable unparameterized path by passing NULL for required_outer and
>> NIL for
>> pathkeys, that's a very strange usage, but I think it will serve the
>> purpose.

>> +    /* Give up if the cheapest-total-cost paths are parameterized. */
>> +    if (!bms_is_empty(PATH_REQ_OUTER(outer_path)) ||
>> +        !bms_is_empty(PATH_REQ_OUTER(inner_path)))
>> +        return NULL;

> I did that because I think that would work well for postgres_fdw, but I
> agree with you.  Will revise.

While working on this, I noticed that in that case 
get_cheapest_path_for_pathkeys() would return NULL because if the 
cheapest-total-cost path is parameterized, then there are no 
unparameterized paths in the rel's pathlist (see set_cheapest).

Best regards,
Etsuro Fujita




Commits

  1. Fix test case for 'outer pathkeys do not match mergeclauses' fix.

  2. postgres_fdw: Avoid 'outer pathkeys do not match mergeclauses' error.

  3. postgres_fdw: Consider foreign joining and foreign sorting together.

  4. Allow foreign and custom joins to handle EvalPlanQual rechecks.

  5. Allow FDWs to push down quals without breaking EvalPlanQual rechecks.