Tweak API of new function clause_is_computable_at().
authorTom Lane <[email protected]>
Thu, 18 May 2023 14:39:16 +0000 (10:39 -0400)
committerTom Lane <[email protected]>
Thu, 18 May 2023 14:39:16 +0000 (10:39 -0400)
Pass it the RestrictInfo under consideration, not just the
clause_relids.  This should save some trivial amount of
code at the call sites, and it gives us more flexibility
about what clause_is_computable_at() does.  There's no
actual functional change here, though.

Discussion: https://postgr.es/m/3564467.1684352557@sss.pgh.pa.us

src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/restrictinfo.c
src/include/optimizer/restrictinfo.h

index 8d5f7c5e8dd842763750f0cf43115b43cbefba11..04ea04b5b64134490515220698b144b1a65f07a6 100644 (file)
@@ -1346,8 +1346,7 @@ subbuild_joinrel_restrictlist(PlannerInfo *root,
                                Assert(!RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids));
                                if (!bms_is_subset(rinfo->required_relids, both_input_relids))
                                        continue;
-                               if (!clause_is_computable_at(root, rinfo->clause_relids,
-                                                                                        both_input_relids))
+                               if (!clause_is_computable_at(root, rinfo, both_input_relids))
                                        continue;
                        }
                        else
@@ -1358,13 +1357,13 @@ subbuild_joinrel_restrictlist(PlannerInfo *root,
                                 */
 #ifdef USE_ASSERT_CHECKING
                                if (RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids))
-                                       Assert(clause_is_computable_at(root, rinfo->clause_relids,
+                                       Assert(clause_is_computable_at(root, rinfo,
                                                                                                   joinrel->relids));
                                else
                                {
                                        Assert(bms_is_subset(rinfo->required_relids,
                                                                                 both_input_relids));
-                                       Assert(clause_is_computable_at(root, rinfo->clause_relids,
+                                       Assert(clause_is_computable_at(root, rinfo,
                                                                                                   both_input_relids));
                                }
 #endif
index c44bd2f8157967a97f025eb27270db92402c7fc6..d2bc096e1cc2bebc48b9c4d8a01568fecf5c797d 100644 (file)
@@ -541,9 +541,10 @@ extract_actual_join_clauses(List *restrictinfo_list,
  */
 bool
 clause_is_computable_at(PlannerInfo *root,
-                                               Relids clause_relids,
+                                               RestrictInfo *rinfo,
                                                Relids eval_relids)
 {
+       Relids          clause_relids = rinfo->clause_relids;
        ListCell   *lc;
 
        /* Nothing to do if no outer joins have been performed yet. */
index c9e30776c52efd63a7b7e7a6d8df5355e47b4dc9..57e7a7999d28faf2381377bc027368f518bda1d4 100644 (file)
@@ -40,7 +40,7 @@ extern void extract_actual_join_clauses(List *restrictinfo_list,
                                                                                List **joinquals,
                                                                                List **otherquals);
 extern bool clause_is_computable_at(PlannerInfo *root,
-                                                                       Relids clause_relids,
+                                                                       RestrictInfo *rinfo,
                                                                        Relids eval_relids);
 extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel);
 extern bool join_clause_is_movable_into(RestrictInfo *rinfo,