* clause_sides_match_join * Determine whether a join clause is of the right form to use in this join. * * We already know that the clause is a binary opclause referencing only the * rels in the current join. The point here is to check whether it has the * form "outerrel_expr op innerrel_expr" or "innerrel_expr op outerrel_expr", * rather than mixing outer and inner vars on either side. I
| 1237 | * we set the transient flag outer_is_left to identify which side is which. |
| 1238 | */ |
| 1239 | static inline bool |
| 1240 | clause_sides_match_join(RestrictInfo *rinfo, RelOptInfo *outerrel, |
| 1241 | RelOptInfo *innerrel) |
| 1242 | { |
| 1243 | if (bms_is_subset(rinfo->left_relids, outerrel->relids) && |
| 1244 | bms_is_subset(rinfo->right_relids, innerrel->relids)) |
| 1245 | { |
| 1246 | /* lefthand side is outer */ |
| 1247 | rinfo->outer_is_left = true; |
| 1248 | return true; |
| 1249 | } |
| 1250 | else if (bms_is_subset(rinfo->left_relids, innerrel->relids) && |
| 1251 | bms_is_subset(rinfo->right_relids, outerrel->relids)) |
| 1252 | { |
| 1253 | /* righthand side is outer */ |
| 1254 | rinfo->outer_is_left = false; |
| 1255 | return true; |
| 1256 | } |
| 1257 | return false; /* no good for these input relations */ |
| 1258 | } |
| 1259 | |
| 1260 | /* |
| 1261 | * sort_inner_and_outer |
no test coverage detected