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

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>
Cc: Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>, Richard Guo <guofenglinux(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: postgres_fdw: wrong results with self join + enable_nestloop off
Date: 2023-06-05 13:19:31
Message-ID: CAPmGK17Gd+hmC2NZF4CzwOZcjv_3ReA4jYgfBKLc4jZLgVW80g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Jun 2, 2023 at 9:31 PM Nishant Sharma
<nishant(dot)sharma(at)enterprisedb(dot)com> wrote:
> I also agree that Richard's patch is better. As it fixes the issue at the backend and does not treat pseudoconstant as local condition.
>
> I have tested Richard's patch and observe that it is resolving the problem. Patch looks good to me as well.

If the patch is intended for HEAD only, I also think it goes in the
right direction. But if it is intended for back branches as well, I
do not think so, because it would cause ABI breakage due to changes
made to the ForeignPath struct and the create_foreign_join_path() API.
(For the former, I think we could avoid doing so by adding the new
member at the end of the struct, not in the middle, though.)

To avoid this issue, I am wondering if we should modify
add_paths_to_joinrel() in back branches so that it just disallows the
FDW to consider pushing down joins when the restrictlist has
pseudoconstant clauses. Attached is a patch for that.

My apologies for not reviewing your patch and the long long delay.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
disallow-join-pushdown-if-pseudoconstants.patch application/octet-stream 5.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Morris de Oryx 2023-06-05 13:21:55 Re: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function
Previous Message Tom Lane 2023-06-05 13:01:25 Re: [BUG] pg_dump does not properly deal with BEGIN ATOMIC function