PostgreSQL Source Code  git master
restrictinfo.c File Reference
#include "postgres.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/optimizer.h"
#include "optimizer/restrictinfo.h"
Include dependency graph for restrictinfo.c:

Go to the source code of this file.

Functions

static RestrictInfomake_restrictinfo_internal (PlannerInfo *root, Expr *clause, Expr *orclause, bool is_pushed_down, bool has_clone, bool is_clone, bool pseudoconstant, Index security_level, Relids required_relids, Relids incompatible_relids, Relids outer_relids)
 
static Exprmake_sub_restrictinfos (PlannerInfo *root, Expr *clause, bool is_pushed_down, bool has_clone, bool is_clone, bool pseudoconstant, Index security_level, Relids required_relids, Relids incompatible_relids, Relids outer_relids)
 
RestrictInfomake_restrictinfo (PlannerInfo *root, Expr *clause, bool is_pushed_down, bool has_clone, bool is_clone, bool pseudoconstant, Index security_level, Relids required_relids, Relids incompatible_relids, Relids outer_relids)
 
RestrictInfocommute_restrictinfo (RestrictInfo *rinfo, Oid comm_op)
 
bool restriction_is_or_clause (RestrictInfo *restrictinfo)
 
bool restriction_is_securely_promotable (RestrictInfo *restrictinfo, RelOptInfo *rel)
 
static bool rinfo_is_constant_true (RestrictInfo *rinfo)
 
Listget_actual_clauses (List *restrictinfo_list)
 
Listextract_actual_clauses (List *restrictinfo_list, bool pseudoconstant)
 
void extract_actual_join_clauses (List *restrictinfo_list, Relids joinrelids, List **joinquals, List **otherquals)
 
bool join_clause_is_movable_to (RestrictInfo *rinfo, RelOptInfo *baserel)
 
bool join_clause_is_movable_into (RestrictInfo *rinfo, Relids currentrelids, Relids current_and_outer)
 

Function Documentation

◆ commute_restrictinfo()

RestrictInfo* commute_restrictinfo ( RestrictInfo rinfo,
Oid  comm_op 
)

Definition at line 359 of file restrictinfo.c.

360 {
361  RestrictInfo *result;
362  OpExpr *newclause;
363  OpExpr *clause = castNode(OpExpr, rinfo->clause);
364 
365  Assert(list_length(clause->args) == 2);
366 
367  /* flat-copy all the fields of clause ... */
368  newclause = makeNode(OpExpr);
369  memcpy(newclause, clause, sizeof(OpExpr));
370 
371  /* ... and adjust those we need to change to commute it */
372  newclause->opno = comm_op;
373  newclause->opfuncid = InvalidOid;
374  newclause->args = list_make2(lsecond(clause->args),
375  linitial(clause->args));
376 
377  /* likewise, flat-copy all the fields of rinfo ... */
378  result = makeNode(RestrictInfo);
379  memcpy(result, rinfo, sizeof(RestrictInfo));
380 
381  /*
382  * ... and adjust those we need to change. Note in particular that we can
383  * preserve any cached selectivity or cost estimates, since those ought to
384  * be the same for the new clause. Likewise we can keep the source's
385  * parent_ec. It's also important that we keep the same rinfo_serial.
386  */
387  result->clause = (Expr *) newclause;
388  result->left_relids = rinfo->right_relids;
389  result->right_relids = rinfo->left_relids;
390  Assert(result->orclause == NULL);
391  result->left_ec = rinfo->right_ec;
392  result->right_ec = rinfo->left_ec;
393  result->left_em = rinfo->right_em;
394  result->right_em = rinfo->left_em;
395  result->scansel_cache = NIL; /* not worth updating this */
396  if (rinfo->hashjoinoperator == clause->opno)
397  result->hashjoinoperator = comm_op;
398  else
399  result->hashjoinoperator = InvalidOid;
400  result->left_bucketsize = rinfo->right_bucketsize;
401  result->right_bucketsize = rinfo->left_bucketsize;
402  result->left_mcvfreq = rinfo->right_mcvfreq;
403  result->right_mcvfreq = rinfo->left_mcvfreq;
404  result->left_hasheqoperator = InvalidOid;
405  result->right_hasheqoperator = InvalidOid;
406 
407  return result;
408 }
Assert(fmt[strlen(fmt) - 1] !='\n')
#define makeNode(_type_)
Definition: nodes.h:155
#define castNode(_type_, nodeptr)
Definition: nodes.h:176
static int list_length(const List *l)
Definition: pg_list.h:152
#define NIL
Definition: pg_list.h:68
#define linitial(l)
Definition: pg_list.h:178
#define lsecond(l)
Definition: pg_list.h:183
#define list_make2(x1, x2)
Definition: pg_list.h:214
#define InvalidOid
Definition: postgres_ext.h:36
Oid opno
Definition: primnodes.h:774
List * args
Definition: primnodes.h:792
Expr * clause
Definition: pathnodes.h:2541

References OpExpr::args, Assert(), castNode, RestrictInfo::clause, InvalidOid, linitial, list_length(), list_make2, lsecond, makeNode, NIL, and OpExpr::opno.

Referenced by match_opclause_to_indexcol().

◆ extract_actual_clauses()

List* extract_actual_clauses ( List restrictinfo_list,
bool  pseudoconstant 
)

Definition at line 494 of file restrictinfo.c.

496 {
497  List *result = NIL;
498  ListCell *l;
499 
500  foreach(l, restrictinfo_list)
501  {
503 
504  if (rinfo->pseudoconstant == pseudoconstant &&
505  !rinfo_is_constant_true(rinfo))
506  result = lappend(result, rinfo->clause);
507  }
508  return result;
509 }
List * lappend(List *list, void *datum)
Definition: list.c:339
#define lfirst_node(type, lc)
Definition: pg_list.h:176
static bool rinfo_is_constant_true(RestrictInfo *rinfo)
Definition: restrictinfo.c:453
Definition: pg_list.h:54

References RestrictInfo::clause, lappend(), lfirst_node, NIL, and rinfo_is_constant_true().

Referenced by create_append_plan(), create_bitmap_scan_plan(), create_ctescan_plan(), create_functionscan_plan(), create_hashjoin_plan(), create_indexscan_plan(), create_merge_append_plan(), create_mergejoin_plan(), create_namedtuplestorescan_plan(), create_nestloop_plan(), create_resultscan_plan(), create_samplescan_plan(), create_seqscan_plan(), create_subqueryscan_plan(), create_tablefuncscan_plan(), create_tidrangescan_plan(), create_tidscan_plan(), create_valuesscan_plan(), create_worktablescan_plan(), fileGetForeignPlan(), get_gating_quals(), and postgresGetForeignPlan().

◆ extract_actual_join_clauses()

void extract_actual_join_clauses ( List restrictinfo_list,
Relids  joinrelids,
List **  joinquals,
List **  otherquals 
)

Definition at line 522 of file restrictinfo.c.

526 {
527  ListCell *l;
528 
529  *joinquals = NIL;
530  *otherquals = NIL;
531 
532  foreach(l, restrictinfo_list)
533  {
535 
536  if (RINFO_IS_PUSHED_DOWN(rinfo, joinrelids))
537  {
538  if (!rinfo->pseudoconstant &&
539  !rinfo_is_constant_true(rinfo))
540  *otherquals = lappend(*otherquals, rinfo->clause);
541  }
542  else
543  {
544  /* joinquals shouldn't have been marked pseudoconstant */
545  Assert(!rinfo->pseudoconstant);
546  if (!rinfo_is_constant_true(rinfo))
547  *joinquals = lappend(*joinquals, rinfo->clause);
548  }
549  }
550 }
#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids)
Definition: pathnodes.h:2698

References Assert(), RestrictInfo::clause, lappend(), lfirst_node, NIL, rinfo_is_constant_true(), and RINFO_IS_PUSHED_DOWN.

Referenced by create_hashjoin_plan(), create_mergejoin_plan(), and create_nestloop_plan().

◆ get_actual_clauses()

List* get_actual_clauses ( List restrictinfo_list)

Definition at line 469 of file restrictinfo.c.

470 {
471  List *result = NIL;
472  ListCell *l;
473 
474  foreach(l, restrictinfo_list)
475  {
477 
478  Assert(!rinfo->pseudoconstant);
480 
481  result = lappend(result, rinfo->clause);
482  }
483  return result;
484 }

References Assert(), RestrictInfo::clause, lappend(), lfirst_node, NIL, and rinfo_is_constant_true().

Referenced by create_bitmap_subplan(), create_hashjoin_plan(), create_join_plan(), and create_mergejoin_plan().

◆ join_clause_is_movable_into()

bool join_clause_is_movable_into ( RestrictInfo rinfo,
Relids  currentrelids,
Relids  current_and_outer 
)

Definition at line 670 of file restrictinfo.c.

673 {
674  /* Clause must be evaluable given available context */
675  if (!bms_is_subset(rinfo->clause_relids, current_and_outer))
676  return false;
677 
678  /* Clause must physically reference at least one target rel */
679  if (!bms_overlap(currentrelids, rinfo->clause_relids))
680  return false;
681 
682  /* Cannot move an outer-join clause into the join's outer side */
683  if (bms_overlap(currentrelids, rinfo->outer_relids))
684  return false;
685 
686  return true;
687 }
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
Definition: bitmapset.c:412
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Definition: bitmapset.c:582
Relids outer_relids
Definition: pathnodes.h:2578

References bms_is_subset(), bms_overlap(), and RestrictInfo::outer_relids.

Referenced by get_baserel_parampathinfo(), get_joinrel_parampathinfo(), and has_indexed_join_quals().

◆ join_clause_is_movable_to()

bool join_clause_is_movable_to ( RestrictInfo rinfo,
RelOptInfo baserel 
)

Definition at line 584 of file restrictinfo.c.

585 {
586  /* Clause must physically reference target rel */
587  if (!bms_is_member(baserel->relid, rinfo->clause_relids))
588  return false;
589 
590  /* Cannot move an outer-join clause into the join's outer side */
591  if (bms_is_member(baserel->relid, rinfo->outer_relids))
592  return false;
593 
594  /*
595  * Target rel's Vars must not be nulled by any outer join. We can check
596  * this without groveling through the individual Vars by seeing whether
597  * clause_relids (which includes all such Vars' varnullingrels) includes
598  * any outer join that can null the target rel. You might object that
599  * this could reject the clause on the basis of an OJ relid that came from
600  * some other rel's Var. However, that would still mean that the clause
601  * came from above that outer join and shouldn't be pushed down; so there
602  * should be no false positives.
603  */
604  if (bms_overlap(rinfo->clause_relids, baserel->nulling_relids))
605  return false;
606 
607  /* Clause must not use any rels with LATERAL references to this rel */
608  if (bms_overlap(baserel->lateral_referencers, rinfo->clause_relids))
609  return false;
610 
611  /* Ignore clones, too */
612  if (rinfo->is_clone)
613  return false;
614 
615  return true;
616 }
bool bms_is_member(int x, const Bitmapset *a)
Definition: bitmapset.c:510
Index relid
Definition: pathnodes.h:903
Relids lateral_referencers
Definition: pathnodes.h:923
Relids nulling_relids
Definition: pathnodes.h:919

References bms_is_member(), bms_overlap(), RestrictInfo::is_clone, RelOptInfo::lateral_referencers, RelOptInfo::nulling_relids, RestrictInfo::outer_relids, and RelOptInfo::relid.

Referenced by BuildParameterizedTidPaths(), check_index_predicates(), extract_restriction_or_clauses(), match_join_clauses_to_index(), and postgresGetForeignPaths().

◆ make_restrictinfo()

RestrictInfo* make_restrictinfo ( PlannerInfo root,
Expr clause,
bool  is_pushed_down,
bool  has_clone,
bool  is_clone,
bool  pseudoconstant,
Index  security_level,
Relids  required_relids,
Relids  incompatible_relids,
Relids  outer_relids 
)

Definition at line 63 of file restrictinfo.c.

73 {
74  /*
75  * If it's an OR clause, build a modified copy with RestrictInfos inserted
76  * above each subclause of the top-level AND/OR structure.
77  */
78  if (is_orclause(clause))
79  return (RestrictInfo *) make_sub_restrictinfos(root,
80  clause,
81  is_pushed_down,
82  has_clone,
83  is_clone,
84  pseudoconstant,
85  security_level,
86  required_relids,
87  incompatible_relids,
88  outer_relids);
89 
90  /* Shouldn't be an AND clause, else AND/OR flattening messed up */
91  Assert(!is_andclause(clause));
92 
93  return make_restrictinfo_internal(root,
94  clause,
95  NULL,
96  is_pushed_down,
97  has_clone,
98  is_clone,
99  pseudoconstant,
100  security_level,
101  required_relids,
102  incompatible_relids,
103  outer_relids);
104 }
static bool is_andclause(const void *clause)
Definition: nodeFuncs.h:105
static bool is_orclause(const void *clause)
Definition: nodeFuncs.h:114
static RestrictInfo * make_restrictinfo_internal(PlannerInfo *root, Expr *clause, Expr *orclause, bool is_pushed_down, bool has_clone, bool is_clone, bool pseudoconstant, Index security_level, Relids required_relids, Relids incompatible_relids, Relids outer_relids)
Definition: restrictinfo.c:112
static Expr * make_sub_restrictinfos(PlannerInfo *root, Expr *clause, bool is_pushed_down, bool has_clone, bool is_clone, bool pseudoconstant, Index security_level, Relids required_relids, Relids incompatible_relids, Relids outer_relids)
Definition: restrictinfo.c:271

References Assert(), is_andclause(), is_orclause(), make_restrictinfo_internal(), and make_sub_restrictinfos().

Referenced by add_base_clause_to_rel(), add_join_clause_to_rels(), apply_child_basequals(), build_implied_join_equality(), consider_new_or_clause(), distribute_qual_to_rels(), foreign_grouping_ok(), process_equivalence(), process_implied_equality(), and reconsider_outer_join_clauses().

◆ make_restrictinfo_internal()

static RestrictInfo * make_restrictinfo_internal ( PlannerInfo root,
Expr clause,
Expr orclause,
bool  is_pushed_down,
bool  has_clone,
bool  is_clone,
bool  pseudoconstant,
Index  security_level,
Relids  required_relids,
Relids  incompatible_relids,
Relids  outer_relids 
)
static

Definition at line 112 of file restrictinfo.c.

123 {
124  RestrictInfo *restrictinfo = makeNode(RestrictInfo);
125  Relids baserels;
126 
127  restrictinfo->clause = clause;
128  restrictinfo->orclause = orclause;
129  restrictinfo->is_pushed_down = is_pushed_down;
130  restrictinfo->pseudoconstant = pseudoconstant;
131  restrictinfo->has_clone = has_clone;
132  restrictinfo->is_clone = is_clone;
133  restrictinfo->can_join = false; /* may get set below */
134  restrictinfo->security_level = security_level;
135  restrictinfo->incompatible_relids = incompatible_relids;
136  restrictinfo->outer_relids = outer_relids;
137 
138  /*
139  * If it's potentially delayable by lower-level security quals, figure out
140  * whether it's leakproof. We can skip testing this for level-zero quals,
141  * since they would never get delayed on security grounds anyway.
142  */
143  if (security_level > 0)
144  restrictinfo->leakproof = !contain_leaked_vars((Node *) clause);
145  else
146  restrictinfo->leakproof = false; /* really, "don't know" */
147 
148  /*
149  * Mark volatility as unknown. The contain_volatile_functions function
150  * will determine if there are any volatile functions when called for the
151  * first time with this RestrictInfo.
152  */
153  restrictinfo->has_volatile = VOLATILITY_UNKNOWN;
154 
155  /*
156  * If it's a binary opclause, set up left/right relids info. In any case
157  * set up the total clause relids info.
158  */
159  if (is_opclause(clause) && list_length(((OpExpr *) clause)->args) == 2)
160  {
161  restrictinfo->left_relids = pull_varnos(root, get_leftop(clause));
162  restrictinfo->right_relids = pull_varnos(root, get_rightop(clause));
163 
164  restrictinfo->clause_relids = bms_union(restrictinfo->left_relids,
165  restrictinfo->right_relids);
166 
167  /*
168  * Does it look like a normal join clause, i.e., a binary operator
169  * relating expressions that come from distinct relations? If so we
170  * might be able to use it in a join algorithm. Note that this is a
171  * purely syntactic test that is made regardless of context.
172  */
173  if (!bms_is_empty(restrictinfo->left_relids) &&
174  !bms_is_empty(restrictinfo->right_relids) &&
175  !bms_overlap(restrictinfo->left_relids,
176  restrictinfo->right_relids))
177  {
178  restrictinfo->can_join = true;
179  /* pseudoconstant should certainly not be true */
180  Assert(!restrictinfo->pseudoconstant);
181  }
182  }
183  else
184  {
185  /* Not a binary opclause, so mark left/right relid sets as empty */
186  restrictinfo->left_relids = NULL;
187  restrictinfo->right_relids = NULL;
188  /* and get the total relid set the hard way */
189  restrictinfo->clause_relids = pull_varnos(root, (Node *) clause);
190  }
191 
192  /* required_relids defaults to clause_relids */
193  if (required_relids != NULL)
194  restrictinfo->required_relids = required_relids;
195  else
196  restrictinfo->required_relids = restrictinfo->clause_relids;
197 
198  /*
199  * Count the number of base rels appearing in clause_relids. To do this,
200  * we just delete rels mentioned in root->outer_join_rels and count the
201  * survivors. Because we are called during deconstruct_jointree which is
202  * the same tree walk that populates outer_join_rels, this is a little bit
203  * unsafe-looking; but it should be fine because the recursion in
204  * deconstruct_jointree should already have visited any outer join that
205  * could be mentioned in this clause.
206  */
207  baserels = bms_difference(restrictinfo->clause_relids,
208  root->outer_join_rels);
209  restrictinfo->num_base_rels = bms_num_members(baserels);
210  bms_free(baserels);
211 
212  /*
213  * Label this RestrictInfo with a fresh serial number.
214  */
215  restrictinfo->rinfo_serial = ++(root->last_rinfo_serial);
216 
217  /*
218  * Fill in all the cacheable fields with "not yet set" markers. None of
219  * these will be computed until/unless needed. Note in particular that we
220  * don't mark a binary opclause as mergejoinable or hashjoinable here;
221  * that happens only if it appears in the right context (top level of a
222  * joinclause list).
223  */
224  restrictinfo->parent_ec = NULL;
225 
226  restrictinfo->eval_cost.startup = -1;
227  restrictinfo->norm_selec = -1;
228  restrictinfo->outer_selec = -1;
229 
230  restrictinfo->mergeopfamilies = NIL;
231 
232  restrictinfo->left_ec = NULL;
233  restrictinfo->right_ec = NULL;
234  restrictinfo->left_em = NULL;
235  restrictinfo->right_em = NULL;
236  restrictinfo->scansel_cache = NIL;
237 
238  restrictinfo->outer_is_left = false;
239 
240  restrictinfo->hashjoinoperator = InvalidOid;
241 
242  restrictinfo->left_bucketsize = -1;
243  restrictinfo->right_bucketsize = -1;
244  restrictinfo->left_mcvfreq = -1;
245  restrictinfo->right_mcvfreq = -1;
246 
247  restrictinfo->left_hasheqoperator = InvalidOid;
248  restrictinfo->right_hasheqoperator = InvalidOid;
249 
250  return restrictinfo;
251 }
void bms_free(Bitmapset *a)
Definition: bitmapset.c:239
int bms_num_members(const Bitmapset *a)
Definition: bitmapset.c:751
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
Definition: bitmapset.c:251
Bitmapset * bms_difference(const Bitmapset *a, const Bitmapset *b)
Definition: bitmapset.c:346
#define bms_is_empty(a)
Definition: bitmapset.h:118
bool contain_leaked_vars(Node *clause)
Definition: clauses.c:1243
static bool is_opclause(const void *clause)
Definition: nodeFuncs.h:74
static Node * get_rightop(const void *clause)
Definition: nodeFuncs.h:93
static Node * get_leftop(const void *clause)
Definition: nodeFuncs.h:81
@ VOLATILITY_UNKNOWN
Definition: pathnodes.h:1478
Definition: nodes.h:129
Relids outer_join_rels
Definition: pathnodes.h:258
int last_rinfo_serial
Definition: pathnodes.h:340
bool is_pushed_down
Definition: pathnodes.h:2544
Index security_level
Definition: pathnodes.h:2563
Relids required_relids
Definition: pathnodes.h:2572
int rinfo_serial
Definition: pathnodes.h:2613
Relids incompatible_relids
Definition: pathnodes.h:2575
bool has_clone
Definition: pathnodes.h:2553
Relids pull_varnos(PlannerInfo *root, Node *node)
Definition: var.c:108

References generate_unaccent_rules::args, Assert(), bms_difference(), bms_free(), bms_is_empty, bms_num_members(), bms_overlap(), bms_union(), RestrictInfo::clause, contain_leaked_vars(), get_leftop(), get_rightop(), RestrictInfo::has_clone, RestrictInfo::incompatible_relids, InvalidOid, RestrictInfo::is_clone, is_opclause(), RestrictInfo::is_pushed_down, PlannerInfo::last_rinfo_serial, list_length(), makeNode, NIL, PlannerInfo::outer_join_rels, RestrictInfo::outer_relids, pull_varnos(), RestrictInfo::required_relids, RestrictInfo::rinfo_serial, RestrictInfo::security_level, and VOLATILITY_UNKNOWN.

Referenced by make_restrictinfo(), and make_sub_restrictinfos().

◆ make_sub_restrictinfos()

static Expr * make_sub_restrictinfos ( PlannerInfo root,
Expr clause,
bool  is_pushed_down,
bool  has_clone,
bool  is_clone,
bool  pseudoconstant,
Index  security_level,
Relids  required_relids,
Relids  incompatible_relids,
Relids  outer_relids 
)
static

Definition at line 271 of file restrictinfo.c.

281 {
282  if (is_orclause(clause))
283  {
284  List *orlist = NIL;
285  ListCell *temp;
286 
287  foreach(temp, ((BoolExpr *) clause)->args)
288  orlist = lappend(orlist,
290  lfirst(temp),
291  is_pushed_down,
292  has_clone,
293  is_clone,
294  pseudoconstant,
295  security_level,
296  NULL,
297  incompatible_relids,
298  outer_relids));
299  return (Expr *) make_restrictinfo_internal(root,
300  clause,
301  make_orclause(orlist),
302  is_pushed_down,
303  has_clone,
304  is_clone,
305  pseudoconstant,
306  security_level,
307  required_relids,
308  incompatible_relids,
309  outer_relids);
310  }
311  else if (is_andclause(clause))
312  {
313  List *andlist = NIL;
314  ListCell *temp;
315 
316  foreach(temp, ((BoolExpr *) clause)->args)
317  andlist = lappend(andlist,
319  lfirst(temp),
320  is_pushed_down,
321  has_clone,
322  is_clone,
323  pseudoconstant,
324  security_level,
325  required_relids,
326  incompatible_relids,
327  outer_relids));
328  return make_andclause(andlist);
329  }
330  else
331  return (Expr *) make_restrictinfo_internal(root,
332  clause,
333  NULL,
334  is_pushed_down,
335  has_clone,
336  is_clone,
337  pseudoconstant,
338  security_level,
339  required_relids,
340  incompatible_relids,
341  outer_relids);
342 }
Expr * make_andclause(List *andclauses)
Definition: makefuncs.c:638
Expr * make_orclause(List *orclauses)
Definition: makefuncs.c:654
#define lfirst(lc)
Definition: pg_list.h:172

References generate_unaccent_rules::args, is_andclause(), is_orclause(), lappend(), lfirst, make_andclause(), make_orclause(), make_restrictinfo_internal(), and NIL.

Referenced by make_restrictinfo().

◆ restriction_is_or_clause()

bool restriction_is_or_clause ( RestrictInfo restrictinfo)

Definition at line 416 of file restrictinfo.c.

417 {
418  if (restrictinfo->orclause != NULL)
419  return true;
420  else
421  return false;
422 }

Referenced by extract_or_clause(), extract_restriction_or_clauses(), generate_bitmap_or_paths(), match_join_clauses_to_index(), remove_rel_from_restrictinfo(), restriction_is_always_false(), restriction_is_always_true(), and TidQualFromRestrictInfoList().

◆ restriction_is_securely_promotable()

bool restriction_is_securely_promotable ( RestrictInfo restrictinfo,
RelOptInfo rel 
)

Definition at line 431 of file restrictinfo.c.

433 {
434  /*
435  * It's okay if there are no baserestrictinfo clauses for the rel that
436  * would need to go before this one, *or* if this one is leakproof.
437  */
438  if (restrictinfo->security_level <= rel->baserestrict_min_security ||
439  restrictinfo->leakproof)
440  return true;
441  else
442  return false;
443 }
Index baserestrict_min_security
Definition: pathnodes.h:970

References RelOptInfo::baserestrict_min_security, and RestrictInfo::security_level.

Referenced by BuildParameterizedTidPaths(), match_clause_to_index(), and TidQualFromRestrictInfo().

◆ rinfo_is_constant_true()

static bool rinfo_is_constant_true ( RestrictInfo rinfo)
inlinestatic

Definition at line 453 of file restrictinfo.c.

454 {
455  return IsA(rinfo->clause, Const) &&
456  !((Const *) rinfo->clause)->constisnull &&
457  DatumGetBool(((Const *) rinfo->clause)->constvalue);
458 }
#define IsA(nodeptr, _type_)
Definition: nodes.h:158
static bool DatumGetBool(Datum X)
Definition: postgres.h:90

References RestrictInfo::clause, DatumGetBool(), and IsA.

Referenced by extract_actual_clauses(), extract_actual_join_clauses(), and get_actual_clauses().