Re: [HACKERS] postgres_fdw bug in 9.6

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

From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Jeff Janes <jeff.janes@gmail.com>, David Steele <david@pgmasters.net>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-01-17T09:02:49Z
Lists: pgsql-hackers
(2018/01/16 12:00), Etsuro Fujita wrote:
> (2018/01/16 11:17), Tom Lane wrote:
>> Etsuro Fujita<fujita.etsuro@lab.ntt.co.jp> writes:
>>> (2018/01/16 1:47), Robert Haas wrote:
>>>> Hmm, I was thinking that bar and baz wouldn't be constrained to return
>>>> just one tuple in that case, but I'm wrong: there would just be one
>>>> tuple per relation in that case. However, that would also be true for
>>>> a full join, wouldn't it?
>>
>>> Consider:
>>
>>> postgres=# create table bar (a int, b text);
>>> postgres=# create table baz (a int, b text);
>>> postgres=# insert into bar values (1, 'bar');
>>> postgres=# insert into baz values (2, 'baz');
>>> postgres=# select * from bar full join baz on bar.a = baz.a;
>>> a | b | a | b
>>> ---+-----+---+-----
>>> 1 | bar | |
>>> | | 2 | baz
>>> (2 rows)
>>
>>> Both relations have one tuple, but the full join produces two join
>>> tuples. I think it would be possible that something like this happens
>>> when executing a local join plan for a foreign join that performs a full
>>> join remotely.
>>
>> Doesn't really matter though, does it? Each of those join rows will
>> be processed as a separate EPQ event.
>
> I assume that such a local join plan is executed as part of a FOR UPDATE
> query like the one shown by Robert (the bar/baz foreign join part in
> that query), so I am thinking that those join rows will be processed as
> a single event.

I realized I am wrong; the local join execution plan would never produce 
multiple tuples in a single event.

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.