parse_oper.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*-------------------------------------------------------------------------
  2. *
  3. * parse_oper.h
  4. * handle operator things for parser
  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/parser/parse_oper.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef PARSE_OPER_H
  15. #define PARSE_OPER_H
  16. #include "access/htup.h"
  17. #include "parser/parse_node.h"
  18. typedef HeapTuple Operator;
  19. /* Routines to look up an operator given name and exact input type(s) */
  20. extern Oid LookupOperName(ParseState *pstate, List *opername,
  21. Oid oprleft, Oid oprright,
  22. bool noError, int location);
  23. extern Oid LookupOperNameTypeNames(ParseState *pstate, List *opername,
  24. TypeName *oprleft, TypeName *oprright,
  25. bool noError, int location);
  26. /* Routines to find operators matching a name and given input types */
  27. /* NB: the selected operator may require coercion of the input types! */
  28. extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
  29. bool noError, int location);
  30. extern Operator right_oper(ParseState *pstate, List *op, Oid arg,
  31. bool noError, int location);
  32. extern Operator left_oper(ParseState *pstate, List *op, Oid arg,
  33. bool noError, int location);
  34. /* Routines to find operators that DO NOT require coercion --- ie, their */
  35. /* input types are either exactly as given, or binary-compatible */
  36. extern Operator compatible_oper(ParseState *pstate, List *op,
  37. Oid arg1, Oid arg2,
  38. bool noError, int location);
  39. /* currently no need for compatible_left_oper/compatible_right_oper */
  40. /* Routines for identifying "<", "=", ">" operators for a type */
  41. extern void get_sort_group_operators(Oid argtype,
  42. bool needLT, bool needEQ, bool needGT,
  43. Oid *ltOpr, Oid *eqOpr, Oid *gtOpr,
  44. bool *isHashable);
  45. /* Convenience routines for common calls on the above */
  46. extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
  47. /* Extract operator OID or underlying-function OID from an Operator tuple */
  48. extern Oid oprid(Operator op);
  49. extern Oid oprfuncid(Operator op);
  50. /* Build expression tree for an operator invocation */
  51. extern Expr *make_op(ParseState *pstate, List *opname,
  52. Node *ltree, Node *rtree, int location);
  53. extern Expr *make_scalar_array_op(ParseState *pstate, List *opname,
  54. bool useOr,
  55. Node *ltree, Node *rtree, int location);
  56. #endif /* PARSE_OPER_H */