1 /*-------------------------------------------------------------------------
2  *
3  * restrictinfo.h
4  *	  prototypes for restrictinfo.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2020, 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(clause)  \
22 	make_restrictinfo(clause, true, false, false, 0, NULL, NULL, NULL)
23 
24 extern RestrictInfo *make_restrictinfo(Expr *clause,
25 									   bool is_pushed_down,
26 									   bool outerjoin_delayed,
27 									   bool pseudoconstant,
28 									   Index security_level,
29 									   Relids required_relids,
30 									   Relids outer_relids,
31 									   Relids nullable_relids);
32 extern RestrictInfo *make_restrictinfo_new(PlannerInfo *root,
33 										   Expr *clause,
34 										   bool is_pushed_down,
35 										   bool outerjoin_delayed,
36 										   bool pseudoconstant,
37 										   Index security_level,
38 										   Relids required_relids,
39 										   Relids outer_relids,
40 										   Relids nullable_relids);
41 extern RestrictInfo *commute_restrictinfo(RestrictInfo *rinfo, Oid comm_op);
42 extern bool restriction_is_or_clause(RestrictInfo *restrictinfo);
43 extern bool restriction_is_securely_promotable(RestrictInfo *restrictinfo,
44 											   RelOptInfo *rel);
45 extern List *get_actual_clauses(List *restrictinfo_list);
46 extern List *extract_actual_clauses(List *restrictinfo_list,
47 									bool pseudoconstant);
48 extern void extract_actual_join_clauses(List *restrictinfo_list,
49 										Relids joinrelids,
50 										List **joinquals,
51 										List **otherquals);
52 extern bool join_clause_is_movable_to(RestrictInfo *rinfo, RelOptInfo *baserel);
53 extern bool join_clause_is_movable_into(RestrictInfo *rinfo,
54 										Relids currentrelids,
55 										Relids current_and_outer);
56 
57 #endif							/* RESTRICTINFO_H */
58