| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* parse_oper.h |
| 4 |
* handle operator things for parser |
| 5 |
* |
| 6 |
* |
| 7 |
* Portions Copyright (c) 1996-2025, 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 |
|
| 22 |
typedef HeapTuple Operator; |
| 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 *opname, Oid ltypeId, |
| 33 |
Oid rtypeId, bool noError, int location); |
| 34 |
extern Operator left_oper(ParseState *pstate, List *op, Oid arg, |
| 35 |
bool noError, int location); |
| 36 |
|
| 37 |
/* Routines to find operators that DO NOT require coercion --- ie, their */ |
| 38 |
/* input types are either exactly as given, or binary-compatible */ |
| 39 |
extern Operator compatible_oper(ParseState *pstate, List *op, |
| 40 |
Oid arg1, Oid arg2, |
| 41 |
bool noError, int location); |
| 42 |
|
| 43 |
/* currently no need for compatible_left_oper/compatible_right_oper */ |
| 44 |
|
| 45 |
/* Error reporting support */ |
| 46 |
extern const char *op_signature_string(List *op, Oid arg1, Oid arg2); |
| 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, Node *last_srf, 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 */ |