11
* $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.60 2009/06/11 14:48:59 momjian Exp $
11
* $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.60.2.1 2009/07/06 18:26:39 tgl Exp $
13
13
*-------------------------------------------------------------------------
275
* make_restrictinfos_from_actual_clauses
277
* Given a list of implicitly-ANDed restriction clauses, produce a list
278
* of RestrictInfo nodes. This is used to reconstitute the RestrictInfo
279
* representation after doing transformations of a list of clauses.
281
* We assume that the clauses are relation-level restrictions and therefore
282
* we don't have to worry about is_pushed_down, outerjoin_delayed, or
283
* nullable_relids (these can be assumed true, false, and NULL, respectively).
284
* We do take care to recognize pseudoconstant clauses properly.
287
make_restrictinfos_from_actual_clauses(PlannerInfo *root,
293
foreach(l, clause_list)
295
Expr *clause = (Expr *) lfirst(l);
300
* It's pseudoconstant if it contains no Vars and no volatile
301
* functions. We probably can't see any sublinks here, so
302
* contain_var_clause() would likely be enough, but for safety
303
* use contain_vars_of_level() instead.
306
!contain_vars_of_level((Node *) clause, 0) &&
307
!contain_volatile_functions((Node *) clause);
310
/* tell createplan.c to check for gating quals */
311
root->hasPseudoConstantQuals = true;
314
rinfo = make_restrictinfo(clause,
320
result = lappend(result, rinfo);
275
326
* make_restrictinfo_internal
277
328
* Common code for the main entry points and the recursive cases.
536
* get_all_actual_clauses
538
* Returns a list containing the bare clauses from 'restrictinfo_list'.
540
* This loses the distinction between regular and pseudoconstant clauses,
541
* so be careful what you use it for.
544
get_all_actual_clauses(List *restrictinfo_list)
549
foreach(l, restrictinfo_list)
551
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
553
Assert(IsA(rinfo, RestrictInfo));
555
result = lappend(result, rinfo->clause);
485
561
* extract_actual_clauses
487
563
* Extract bare clauses from 'restrictinfo_list', returning either the