PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 "parser/parse_node.h"
19 
20 
22 
23 /* Routines to look up an operator given name and exact input type(s) */
24 extern Oid LookupOperName(ParseState *pstate, List *opername,
25  Oid oprleft, Oid oprright,
26  bool noError, int location);
27 extern Oid LookupOperNameTypeNames(ParseState *pstate, List *opername,
28  TypeName *oprleft, TypeName *oprright,
29  bool noError, int location);
30 
31 /* Routines to find operators matching a name and given input types */
32 /* NB: the selected operator may require coercion of the input types! */
33 extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
34  bool noError, int location);
35 extern Operator right_oper(ParseState *pstate, List *op, Oid arg,
36  bool noError, int location);
37 extern Operator left_oper(ParseState *pstate, List *op, Oid arg,
38  bool noError, int location);
39 
40 /* Routines to find operators that DO NOT require coercion --- ie, their */
41 /* input types are either exactly as given, or binary-compatible */
42 extern Operator compatible_oper(ParseState *pstate, List *op,
43  Oid arg1, Oid arg2,
44  bool noError, int location);
45 
46 /* currently no need for compatible_left_oper/compatible_right_oper */
47 
48 /* Routines for identifying "<", "=", ">" operators for a type */
49 extern void get_sort_group_operators(Oid argtype,
50  bool needLT, bool needEQ, bool needGT,
51  Oid *ltOpr, Oid *eqOpr, Oid *gtOpr,
52  bool *isHashable);
53 
54 /* Convenience routines for common calls on the above */
55 extern Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
56 
57 /* Extract operator OID or underlying-function OID from an Operator tuple */
58 extern Oid oprid(Operator op);
59 extern Oid oprfuncid(Operator op);
60 
61 /* Build expression tree for an operator invocation */
62 extern Expr *make_op(ParseState *pstate, List *opname,
63  Node *ltree, Node *rtree, int location);
64 extern Expr *make_scalar_array_op(ParseState *pstate, List *opname,
65  bool useOr,
66  Node *ltree, Node *rtree, int location);
67 
68 #endif /* PARSE_OPER_H */
Operator right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
Definition: parse_oper.c:523
Oid oprfuncid(Operator op)
Definition: parse_oper.c:250
Operator compatible_oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location)
Definition: parse_oper.c:455
HeapTuple Operator
Definition: parse_oper.h:21
Definition: nodes.h:508
unsigned int Oid
Definition: postgres_ext.h:31
Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
Definition: parse_oper.c:492
Oid oprid(Operator op)
Definition: parse_oper.c:243
Definition: ltree.h:19
Oid LookupOperNameTypeNames(ParseState *pstate, List *opername, TypeName *oprleft, TypeName *oprright, bool noError, int location)
Definition: parse_oper.c:142
Expr * make_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, int location)
Definition: parse_oper.c:740
Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2, bool noError, int location)
Definition: parse_oper.c:375
Operator left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
Definition: parse_oper.c:602
Expr * make_scalar_array_op(ParseState *pstate, List *opname, bool useOr, Node *ltree, Node *rtree, int location)
Definition: parse_oper.c:856
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:185