On Thu, Jul 24, 2025 at 9:04 AM Tomas Vondra <to...@vondra.me> wrote:
> With this patch, my custom join can simply do
>
>     econtext->ecxt_outertuple = outer;
>     econtext->ecxt_innertuple = inner;
>
>     return ExecProject(node->js.ps.ps_ProjInfo);
>
> and it works.

This doesn't seem like the right approach to me because, AFAICS, it's
only going to work if you're replacing a single join. But I think it
would be very desirable for a CustomScan to be able to replace
multiple joins with a single scan node and handle all the details
internally. I'm fairly certain that was part of the original design
intent here.

And I think that must already work for foreign joins, because I
believe postgres_fdw is perfectly capable of pushing a multi-way join
down to a remote node -- and if it's doing that, it's somehow solving
the problem you encountered here. So maybe we can study how that works
and figure out how to apply it to this case.

-- 
Robert Haas
EDB: http://www.enterprisedb.com


Reply via email to