clauses.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*-------------------------------------------------------------------------
  2. *
  3. * clauses.h
  4. * prototypes for clauses.c.
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2016, 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. #include "nodes/relation.h"
  17. #define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr))
  18. #define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr))
  19. typedef struct
  20. {
  21. int numWindowFuncs; /* total number of WindowFuncs found */
  22. Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */
  23. List **windowFuncs; /* lists of WindowFuncs for each winref */
  24. } WindowFuncLists;
  25. extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
  26. Expr *leftop, Expr *rightop,
  27. Oid opcollid, Oid inputcollid);
  28. extern Node *get_leftop(const Expr *clause);
  29. extern Node *get_rightop(const Expr *clause);
  30. extern bool not_clause(Node *clause);
  31. extern Expr *make_notclause(Expr *notclause);
  32. extern Expr *get_notclausearg(Expr *notclause);
  33. extern bool or_clause(Node *clause);
  34. extern Expr *make_orclause(List *orclauses);
  35. extern bool and_clause(Node *clause);
  36. extern Expr *make_andclause(List *andclauses);
  37. extern Node *make_and_qual(Node *qual1, Node *qual2);
  38. extern Expr *make_ands_explicit(List *andclauses);
  39. extern List *make_ands_implicit(Expr *clause);
  40. extern bool contain_agg_clause(Node *clause);
  41. extern void get_agg_clause_costs(PlannerInfo *root, Node *clause,
  42. AggSplit aggsplit, AggClauseCosts *costs);
  43. extern bool contain_window_function(Node *clause);
  44. extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
  45. extern double expression_returns_set_rows(Node *clause);
  46. extern double tlist_returns_set_rows(List *tlist);
  47. extern bool contain_subplans(Node *clause);
  48. extern bool contain_mutable_functions(Node *clause);
  49. extern bool contain_volatile_functions(Node *clause);
  50. extern bool contain_volatile_functions_not_nextval(Node *clause);
  51. extern bool has_parallel_hazard(Node *node, bool allow_restricted);
  52. extern bool contain_nonstrict_functions(Node *clause);
  53. extern bool contain_leaked_vars(Node *clause);
  54. extern Relids find_nonnullable_rels(Node *clause);
  55. extern List *find_nonnullable_vars(Node *clause);
  56. extern List *find_forced_null_vars(Node *clause);
  57. extern Var *find_forced_null_var(Node *clause);
  58. extern bool is_pseudo_constant_clause(Node *clause);
  59. extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids);
  60. extern int NumRelids(Node *clause);
  61. extern void CommuteOpExpr(OpExpr *clause);
  62. extern void CommuteRowCompareExpr(RowCompareExpr *clause);
  63. extern Node *eval_const_expressions(PlannerInfo *root, Node *node);
  64. extern Node *estimate_expression_value(PlannerInfo *root, Node *node);
  65. extern Query *inline_set_returning_function(PlannerInfo *root,
  66. RangeTblEntry *rte);
  67. #endif /* CLAUSES_H */