Re: PoC: adding CustomJoin, separate from CustomScan

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PoC: adding CustomJoin, separate from CustomScan
Date: 2025-07-24 13:57:03
Message-ID: CA+TgmoaxSJ6XA+xaT=CvXqxyjCrdTu_VSLo9F7UrGu3qLRptWw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 24, 2025 at 9:04 AM Tomas Vondra <tomas(at)vondra(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2025-07-24 14:10:16 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions
Previous Message jian he 2025-07-24 13:44:22 Re: CAST(... ON DEFAULT) - WIP build on top of Error-Safe User Functions