Tweak API of new function clause_is_computable_at().

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
This commit is contained in:
Tom Lane 2023-05-18 10:39:16 -04:00
parent 1c634f6647
commit 8a2523ff35
3 changed files with 6 additions and 6 deletions

View File

@ -1346,8 +1346,7 @@ subbuild_joinrel_restrictlist(PlannerInfo *root,
Assert(!RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids)); Assert(!RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids));
if (!bms_is_subset(rinfo->required_relids, both_input_relids)) if (!bms_is_subset(rinfo->required_relids, both_input_relids))
continue; continue;
if (!clause_is_computable_at(root, rinfo->clause_relids, if (!clause_is_computable_at(root, rinfo, both_input_relids))
both_input_relids))
continue; continue;
} }
else else
@ -1358,13 +1357,13 @@ subbuild_joinrel_restrictlist(PlannerInfo *root,
*/ */
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
if (RINFO_IS_PUSHED_DOWN(rinfo, joinrel->relids)) 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)); joinrel->relids));
else else
{ {
Assert(bms_is_subset(rinfo->required_relids, Assert(bms_is_subset(rinfo->required_relids,
both_input_relids)); both_input_relids));
Assert(clause_is_computable_at(root, rinfo->clause_relids, Assert(clause_is_computable_at(root, rinfo,
both_input_relids)); both_input_relids));
} }
#endif #endif

View File

@ -541,9 +541,10 @@ extract_actual_join_clauses(List *restrictinfo_list,
*/ */
bool bool
clause_is_computable_at(PlannerInfo *root, clause_is_computable_at(PlannerInfo *root,
Relids clause_relids, RestrictInfo *rinfo,
Relids eval_relids) Relids eval_relids)
{ {
Relids clause_relids = rinfo->clause_relids;
ListCell *lc; ListCell *lc;
/* Nothing to do if no outer joins have been performed yet. */ /* Nothing to do if no outer joins have been performed yet. */

View File

@ -40,7 +40,7 @@ extern void extract_actual_join_clauses(List *restrictinfo_list,
List **joinquals, List **joinquals,
List **otherquals); List **otherquals);
extern bool clause_is_computable_at(PlannerInfo *root, extern bool clause_is_computable_at(PlannerInfo *root,
Relids clause_relids, RestrictInfo *rinfo,
Relids eval_relids); Relids eval_relids);
extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel); extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel);
extern bool join_clause_is_movable_into(RestrictInfo *rinfo, extern bool join_clause_is_movable_into(RestrictInfo *rinfo,