Re: postgres_fdw: wrong results with self join + enable_nestloop off

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>, Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: postgres_fdw: wrong results with self join + enable_nestloop off
Date: 2023-07-28 08:55:52
Message-ID: CAPmGK16ah9JtyVPtdqu6d=QGkRX=RAzoYQfX7=LZ+KnqwBfftg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Richard,

On Mon, Jul 24, 2023 at 11:45 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> On Fri, Jul 21, 2023 at 8:51 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote:
>> * In this bit I changed the last argument to NIL, which would be
>> nitpicking, though.
>>
>> @@ -1038,7 +1038,7 @@ postgresGetForeignPaths(PlannerInfo *root,
>> add_path(baserel, (Path *) path);
>>
>> /* Add paths with pathkeys */
>> - add_paths_with_pathkeys_for_rel(root, baserel, NULL);
>> + add_paths_with_pathkeys_for_rel(root, baserel, NULL, NULL);

> This was my oversight.

No. IIUC, I think that that would work well as-proposed, but I
changed it as such, for readability.

> So the two patches both look good to me now.

Cool! I pushed the first patch after polishing it a little bit, so
here is a rebased version of the second patch, in which I modified the
ForeignPath and CustomPath cases in reparameterize_path_by_child() to
reflect the new members fdw_restrictinfo and custom_restrictinfo, for
safety, and tweaked a comment a bit.

Thanks for looking!

Best regards,
Etsuro Fujita

Attachment Content-Type Size
0002-Allow-join-pushdown-even-if-pseudoconstant-quals-v3.patch application/octet-stream 19.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2023-07-28 08:56:26 Re: Row pattern recognition
Previous Message Karina Litskevich 2023-07-28 08:53:09 Re: Avoid unused value (src/fe_utils/print.c)