This is an automated email from the ASF dual-hosted git repository.

tuhaihe pushed a commit to branch REL_2_STABLE
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit fe3ff71b6b6a98dcd19e6799e6912dae53dfc52a
Author: Etsuro Fujita <[email protected]>
AuthorDate: Thu Sep 21 19:45:05 2023 +0900

    Update comment about set_join_pathlist_hook().
    
    The comment introduced by commit e7cb7ee14 was a bit too terse, which
    could lead to extensions doing different things within the hook function
    than we intend to allow.  Extend the comment to explain what they can do
    within the hook function.
    
    Back-patch to all supported branches.
    
    In passing, I rephrased a nearby comment that I recently added to the
    back branches.
    
    Reviewed by David Rowley and Andrei Lepikhov.
    
    Discussion: 
https://postgr.es/m/CAPmGK15SBPA1nr3Aqsdm%2BYyS-ay0Ayo2BRYQ8_A2To9eLqwopQ%40mail.gmail.com
---
 src/backend/optimizer/path/joinpath.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/backend/optimizer/path/joinpath.c 
b/src/backend/optimizer/path/joinpath.c
index b5e7ef3b60c..5defbdd3613 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -367,6 +367,18 @@ add_paths_to_join_relation(PlannerInfo *root,
                hash_inner_and_outer(root, joinrel, outerrel, innerrel,
                                                         jointype, &extra);
 
+       /*
+        * createplan.c does not currently support handling of pseudoconstant
+        * clauses assigned to joins pushed down by extensions; check if the
+        * restrictlist has such clauses, and if not, allow them to consider
+        * pushing down joins.
+        */
+       if ((joinrel->fdwroutine &&
+                joinrel->fdwroutine->GetForeignJoinPaths) ||
+               set_join_pathlist_hook)
+               consider_join_pushdown = !has_pseudoconstant_clauses(root,
+                                                                               
                                         restrictlist);
+
        /*
         * 5. If inner and outer relations are foreign tables (or joins) 
belonging
         * to the same server and assigned to the same user to check access
@@ -424,7 +436,10 @@ add_paths_to_join_relation(PlannerInfo *root,
        }
 
        /*
-        * 6. Finally, give extensions a chance to manipulate the path list.
+        * 6. Finally, give extensions a chance to manipulate the path list.  
They
+        * could add new paths (such as CustomPaths) by calling add_path(), or
+        * add_partial_path() if parallel aware.  They could also delete or 
modify
+        * paths added by the core code.
         */
        if (set_join_pathlist_hook)
                set_join_pathlist_hook(root, joinrel, outerrel, innerrel,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to