Re: using CustomScan to inject nodes into the plan - Mailing list pgsql-hackers

From Tom Lane
Subject Re: using CustomScan to inject nodes into the plan
Date
Msg-id 10102.1426107223@sss.pgh.pa.us
Whole thread Raw
In response to using CustomScan to inject nodes into the plan  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: using CustomScan to inject nodes into the plan  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> I've been experimenting with using CustomScan to inject nodes into the
> plan - I'm experimenting a bit, and this seemed like a nice way to do
> that in an extension, outside the tree.

> Sadly set_rel_pathlist_hook is not flexible enough, because it only
> allows overriding paths for base relations, while I'd like to inject
> nodes above joins, for example, so instead of

It's Custom*Scan*, not Custom-anything-you-want.  It's only supposed
to exist at the bottom level of the plan tree, and that's why it does
not have fields that would allow using it somewhere else.  Quite aside
from the scanrelid thing, haven't you noticed that it lacks any link to
child plan nodes?

I'm not terribly on board with this whole concept of adding plan nodes
from extensions; I do not believe that that approach will ever lead to
anything except horrid kluges, bad planning decisions, and requests for
ever-more-outre hooks to shift the kluginess somewhere else.  But as
Robert says, the custom join thing is more likely to be usable for this,
and it would be interesting to hear just how bad the impedance mismatch
is if you try that.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: proposal: searching in array function - array_position
Next
From: Tom Lane
Date:
Subject: Re: Strange assertion using VACOPT_FREEZE in vacuum.c