Coverage Report

Created: 2026-08-14 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/postgres/src/include/optimizer/restrictinfo.h
Line
Count
Source
1
/*-------------------------------------------------------------------------
2
 *
3
 * restrictinfo.h
4
 *    prototypes for restrictinfo.c.
5
 *
6
 *
7
 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
8
 * Portions Copyright (c) 1994, Regents of the University of California
9
 *
10
 * src/include/optimizer/restrictinfo.h
11
 *
12
 *-------------------------------------------------------------------------
13
 */
14
#ifndef RESTRICTINFO_H
15
#define RESTRICTINFO_H
16
17
#include "nodes/pathnodes.h"
18
19
20
/* Convenience macro for the common case of a valid-everywhere qual */
21
#define make_simple_restrictinfo(root, clause)  \
22
0
  make_restrictinfo(root, clause, true, false, false, false, 0, \
23
0
    NULL, NULL, NULL)
24
25
extern RestrictInfo *make_plain_restrictinfo(PlannerInfo *root,
26
                       Expr *clause,
27
                       Expr *orclause,
28
                       bool is_pushed_down,
29
                       bool has_clone,
30
                       bool is_clone,
31
                       bool pseudoconstant,
32
                       Index security_level,
33
                       Relids required_relids,
34
                       Relids incompatible_relids,
35
                       Relids outer_relids);
36
extern RestrictInfo *make_restrictinfo(PlannerInfo *root,
37
                     Expr *clause,
38
                     bool is_pushed_down,
39
                     bool has_clone,
40
                     bool is_clone,
41
                     bool pseudoconstant,
42
                     Index security_level,
43
                     Relids required_relids,
44
                     Relids incompatible_relids,
45
                     Relids outer_relids);
46
extern RestrictInfo *commute_restrictinfo(RestrictInfo *rinfo, Oid comm_op);
47
extern bool restriction_is_or_clause(RestrictInfo *restrictinfo);
48
extern bool restriction_is_securely_promotable(RestrictInfo *restrictinfo,
49
                         RelOptInfo *rel);
50
extern List *get_actual_clauses(List *restrictinfo_list);
51
extern List *extract_actual_clauses(List *restrictinfo_list,
52
                  bool pseudoconstant);
53
extern void extract_actual_join_clauses(List *restrictinfo_list,
54
                    Relids joinrelids,
55
                    List **joinquals,
56
                    List **otherquals);
57
extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel);
58
extern bool join_clause_is_movable_into(RestrictInfo *rinfo,
59
                    Relids currentrelids,
60
                    Relids current_and_outer);
61
62
/*
63
 * clause_sides_match_join
64
 *    Determine whether a join clause is of the right form to use in this join.
65
 *
66
 * We already know that the clause is a binary opclause referencing only the
67
 * rels in the current join.  The point here is to check whether it has the
68
 * form "outerrel_expr op innerrel_expr" or "innerrel_expr op outerrel_expr",
69
 * rather than mixing outer and inner vars on either side.  If it matches,
70
 * we set the transient flag outer_is_left to identify which side is which.
71
 */
72
static inline bool
73
clause_sides_match_join(RestrictInfo *rinfo, Relids outerrelids,
74
            Relids innerrelids)
75
0
{
76
0
  if (bms_is_subset(rinfo->left_relids, outerrelids) &&
77
0
    bms_is_subset(rinfo->right_relids, innerrelids))
78
0
  {
79
    /* lefthand side is outer */
80
0
    rinfo->outer_is_left = true;
81
0
    return true;
82
0
  }
83
0
  else if (bms_is_subset(rinfo->left_relids, innerrelids) &&
84
0
       bms_is_subset(rinfo->right_relids, outerrelids))
85
0
  {
86
    /* righthand side is outer */
87
0
    rinfo->outer_is_left = false;
88
0
    return true;
89
0
  }
90
0
  return false;        /* no good for these input relations */
91
0
}
Unexecuted instantiation: costsize.c:clause_sides_match_join
Unexecuted instantiation: equivclass.c:clause_sides_match_join
Unexecuted instantiation: indxpath.c:clause_sides_match_join
Unexecuted instantiation: joinpath.c:clause_sides_match_join
Unexecuted instantiation: tidpath.c:clause_sides_match_join
Unexecuted instantiation: analyzejoins.c:clause_sides_match_join
Unexecuted instantiation: createplan.c:clause_sides_match_join
Unexecuted instantiation: initsplan.c:clause_sides_match_join
Unexecuted instantiation: inherit.c:clause_sides_match_join
Unexecuted instantiation: joininfo.c:clause_sides_match_join
Unexecuted instantiation: orclauses.c:clause_sides_match_join
Unexecuted instantiation: relnode.c:clause_sides_match_join
Unexecuted instantiation: restrictinfo.c:clause_sides_match_join
92
93
#endif              /* RESTRICTINFO_H */