Header And Logo

PostgreSQL
| The world's most advanced open source database.

parse_oper.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * parse_oper.h
00004  *      handle operator things for parser
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/parser/parse_oper.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef PARSE_OPER_H
00015 #define PARSE_OPER_H
00016 
00017 #include "access/htup.h"
00018 #include "parser/parse_node.h"
00019 
00020 
00021 typedef HeapTuple Operator;
00022 
00023 /* Routines to look up an operator given name and exact input type(s) */
00024 extern Oid LookupOperName(ParseState *pstate, List *opername,
00025                Oid oprleft, Oid oprright,
00026                bool noError, int location);
00027 extern Oid LookupOperNameTypeNames(ParseState *pstate, List *opername,
00028                         TypeName *oprleft, TypeName *oprright,
00029                         bool noError, int location);
00030 
00031 /* Routines to find operators matching a name and given input types */
00032 /* NB: the selected operator may require coercion of the input types! */
00033 extern Operator oper(ParseState *pstate, List *op, Oid arg1, Oid arg2,
00034      bool noError, int location);
00035 extern Operator right_oper(ParseState *pstate, List *op, Oid arg,
00036            bool noError, int location);
00037 extern Operator left_oper(ParseState *pstate, List *op, Oid arg,
00038           bool noError, int location);
00039 
00040 /* Routines to find operators that DO NOT require coercion --- ie, their */
00041 /* input types are either exactly as given, or binary-compatible */
00042 extern Operator compatible_oper(ParseState *pstate, List *op,
00043                 Oid arg1, Oid arg2,
00044                 bool noError, int location);
00045 
00046 /* currently no need for compatible_left_oper/compatible_right_oper */
00047 
00048 /* Routines for identifying "<", "=", ">" operators for a type */
00049 extern void get_sort_group_operators(Oid argtype,
00050                          bool needLT, bool needEQ, bool needGT,
00051                          Oid *ltOpr, Oid *eqOpr, Oid *gtOpr,
00052                          bool *isHashable);
00053 
00054 /* Convenience routines for common calls on the above */
00055 extern Oid  compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError);
00056 
00057 /* Extract operator OID or underlying-function OID from an Operator tuple */
00058 extern Oid  oprid(Operator op);
00059 extern Oid  oprfuncid(Operator op);
00060 
00061 /* Build expression tree for an operator invocation */
00062 extern Expr *make_op(ParseState *pstate, List *opname,
00063         Node *ltree, Node *rtree, int location);
00064 extern Expr *make_scalar_array_op(ParseState *pstate, List *opname,
00065                      bool useOr,
00066                      Node *ltree, Node *rtree, int location);
00067 
00068 #endif   /* PARSE_OPER_H */