Re: PoC: adding CustomJoin, separate from CustomScan - Mailing list pgsql-hackers

From Robert Haas
Subject Re: PoC: adding CustomJoin, separate from CustomScan
Date
Msg-id CA+TgmoaxSJ6XA+xaT=CvXqxyjCrdTu_VSLo9F7UrGu3qLRptWw@mail.gmail.com
Whole thread Raw
In response to PoC: adding CustomJoin, separate from CustomScan  (Tomas Vondra <tomas@vondra.me>)
Responses Re: PoC: adding CustomJoin, separate from CustomScan
List pgsql-hackers
On Thu, Jul 24, 2025 at 9:04 AM Tomas Vondra <tomas@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



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Next
From: Vik Fearing
Date:
Subject: Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions