PostgreSQL Source Code  git master
parse_oper.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * parse_oper.h
4  * handle operator things for parser
5  *
6  *
7  * Portions Copyright (c) 1996-2017, 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 
17 #include "access/htup.h"
18 #include "nodes/parsenodes.h"
19 #include "parser/parse_node.h"
20 
21 
23 
24 /* Routines to look up an operator given name and exact input type(s) */
25 extern Oid LookupOperName(ParseState *pstate, List *opername,
26  Oid oprleft, Oid oprright,
27  bool noError, int location);
28 extern Oid LookupOperWithArgs(ObjectWithArgs *oper, bool noError);
29 
30 /* Routines to find operators matching a name and given input types */
31 /* NB: the selected operator may require coercion of the input types! */
32 extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
33  bool noError, int location);
34 extern Operator right_oper(ParseState *pstate, List *op, Oid arg,
35  bool noError, int location);
36 extern Operator left_oper(ParseState *pstate, List *op, Oid arg,
37  bool noError, int location);
38 
39 /* Routines to find operators that DO NOT require coercion --- ie, their */
40 /* input types are either exactly as given, or binary-compatible */
41 extern Operator compatible_oper(ParseState *pstate, List *op,
42  Oid arg1, Oid arg2,
43  bool noError, int location);
44 
45 /* currently no need for compatible_left_oper/compatible_right_oper */
46 
47 /* Routines for identifying "<", "=", ">" operators for a type */
48 extern void get_sort_group_operators(Oid argtype,
49  bool needLT, bool needEQ, bool needGT,
50  Oid *ltOpr, Oid *eqOpr, Oid *gtOpr,
51  bool *isHashable);
52 
53 /* Convenience routines for common calls on the above */
54 extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
55 
56 /* Extract operator OID or underlying-function OID from an Operator tuple */
57 extern Oid oprid(Operator op);
58 extern Oid oprfuncid(Operator op);
59 
60 /* Build expression tree for an operator invocation */
61 extern Expr *make_op(ParseState *pstate, List *opname,
62  Node *ltree, Node *rtree, Node *last_srf, int location);
63 extern Expr *make_scalar_array_op(ParseState *pstate, List *opname,
64  bool useOr,
65  Node *ltree, Node *rtree, int location);
66 
67 #endif /* PARSE_OPER_H */
Operator right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
Definition: parse_oper.c:525
Oid oprfuncid(Operator op)
Definition: parse_oper.c:252
Operator compatible_oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location)
Definition: parse_oper.c:457
HeapTuple Operator
Definition: parse_oper.h:22
Definition: nodes.h:512
unsigned int Oid
Definition: postgres_ext.h:31
Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
Definition: parse_oper.c:494
Oid oprid(Operator op)
Definition: parse_oper.c:245
Definition: ltree.h:19
Oid LookupOperWithArgs(ObjectWithArgs *oper, bool noError)
Definition: parse_oper.c:140
Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location)
Definition: parse_oper.c:377
Expr * make_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, Node *last_srf, int location)
Definition: parse_oper.c:747
Operator left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
Definition: parse_oper.c:604
Expr * make_scalar_array_op(ParseState *pstate, List *opname, bool useOr, Node *ltree, Node *rtree, int location)
Definition: parse_oper.c:867
Oid LookupOperName(ParseState *pstate, List *opername, Oid oprleft, Oid oprright, bool noError, int location)
Definition: parse_oper.c:102
void * arg
Definition: pg_list.h:45
void get_sort_group_operators(Oid argtype, bool needLT, bool needEQ, bool needGT, Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, bool *isHashable)
Definition: parse_oper.c:187