1/*-------------------------------------------------------------------------
2 *
3 * clauses.h
4 * prototypes for clauses.c.
5 *
6 *
7 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/optimizer/clauses.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef CLAUSES_H
15#define CLAUSES_H
16
17#include "access/htup.h"
18#include "nodes/pathnodes.h"
19
20typedef struct
21{
22 int numWindowFuncs; /* total number of WindowFuncs found */
23 Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */
24 List **windowFuncs; /* lists of WindowFuncs for each winref */
25} WindowFuncLists;
26
27extern bool contain_agg_clause(Node *clause);
28extern void get_agg_clause_costs(PlannerInfo *root, Node *clause,
29 AggSplit aggsplit, AggClauseCosts *costs);
30
31extern bool contain_window_function(Node *clause);
32extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
33
34extern double expression_returns_set_rows(PlannerInfo *root, Node *clause);
35
36extern bool contain_subplans(Node *clause);
37
38extern char max_parallel_hazard(Query *parse);
39extern bool is_parallel_safe(PlannerInfo *root, Node *node);
40extern bool contain_nonstrict_functions(Node *clause);
41extern bool contain_leaked_vars(Node *clause);
42
43extern Relids find_nonnullable_rels(Node *clause);
44extern List *find_nonnullable_vars(Node *clause);
45extern List *find_forced_null_vars(Node *clause);
46extern Var *find_forced_null_var(Node *clause);
47
48extern bool is_pseudo_constant_clause(Node *clause);
49extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids);
50
51extern int NumRelids(Node *clause);
52
53extern void CommuteOpExpr(OpExpr *clause);
54
55extern Query *inline_set_returning_function(PlannerInfo *root,
56 RangeTblEntry *rte);
57
58#endif /* CLAUSES_H */
59