2015/03/23 9:12、Kouhei Kaigai <kaigai@ak.jp.nec.com> のメール:
> Sorry for my response late. It was not easy to code during business trip.
>
> The attached patch adds a hook for FDW/CSP to replace entire join-subtree
> by a foreign/custom-scan, according to the discussion upthread.
>
> GetForeignJoinPaths handler of FDW is simplified as follows:
> typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root,
> RelOptInfo *joinrel);
It’s not a critical issue but I’d like to propose to rename add_joinrel_extra_paths() to add_extra_paths_to_joinrel(),
becausethe latter would make it more clear that it does extra work in addition to add_paths_to_joinrel().
> It takes PlannerInfo and RelOptInfo of the join-relation to be replaced
> if available. RelOptInfo contains 'relids' bitmap, so FDW driver will be
> able to know the relations to be involved and construct a remote join query.
> However, it is not obvious with RelOptInfo to know how relations are joined.
>
> The function below will help implement FDW driver that support remote join.
>
> List *
> get_joinrel_broken_down(PlannerInfo *root, RelOptInfo *joinrel,
> SpecialJoinInfo **p_sjinfo)
>
> It returns a list of RelOptInfo to be involved in the relations join that
> is represented with 'joinrel', and also set a SpecialJoinInfo on the third
> argument if not inner join.
> In case of inner join, it returns multiple (more than or equal to 2)
> relations to be inner-joined. Elsewhere, it returns two relations and
> a valid SpecialJoinInfo.
As far as I tested, it works fine for SEMI and ANTI.
# I want dump function of BitmapSet for debugging, as Node has nodeToString()...
> At this moment, I'm not 100% certain about its logic. Especially, I didn't
> test SEMI- and ANTI- join cases yet.
> However, time is money - I want people to check overall design first, rather
> than detailed debugging. Please tell me if I misunderstood the logic to break
> down join relations.
With applying your patch, regression tests of “updatable view” failed. regression.diff contains some errors like this:
! ERROR: could not find RelOptInfo for given relids
Could you check that?
—
Shigeru HANADA