| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* parse_func.h |
| 4 |
* |
| 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_func.h |
| 11 |
* |
| 12 |
*------------------------------------------------------------------------- |
| 13 |
*/ |
| 14 |
#ifndef PARSE_FUNC_H |
| 15 |
#define PARSE_FUNC_H |
| 16 |
|
| 17 |
#include "catalog/namespace.h" |
| 18 |
#include "parser/parse_node.h" |
| 19 |
|
| 20 |
|
| 21 |
/* Result codes for func_get_detail */ |
| 22 |
typedef enum |
| 23 |
{ |
| 24 |
FUNCDETAIL_NOTFOUND, /* no matching function */ |
| 25 |
FUNCDETAIL_MULTIPLE, /* too many matching functions */ |
| 26 |
FUNCDETAIL_NORMAL, /* found a matching regular function */ |
| 27 |
FUNCDETAIL_PROCEDURE, /* found a matching procedure */ |
| 28 |
FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */ |
| 29 |
FUNCDETAIL_WINDOWFUNC, /* found a matching window function */ |
| 30 |
FUNCDETAIL_COERCION, /* it's a type coercion request */ |
| 31 |
} FuncDetailCode; |
| 32 |
|
| 33 |
|
| 34 |
extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, |
| 35 |
Node *last_srf, FuncCall *fn, bool proc_call, |
| 36 |
int location); |
| 37 |
|
| 38 |
extern FuncDetailCode func_get_detail(List *funcname, |
| 39 |
List *fargs, List *fargnames, |
| 40 |
int nargs, Oid *argtypes, |
| 41 |
bool expand_variadic, bool expand_defaults, |
| 42 |
bool include_out_arguments, |
| 43 |
Oid *funcid, Oid *rettype, |
| 44 |
bool *retset, int *nvargs, Oid *vatype, |
| 45 |
Oid **true_typeids, List **argdefaults); |
| 46 |
|
| 47 |
extern int func_match_argtypes(int nargs, |
| 48 |
Oid *input_typeids, |
| 49 |
FuncCandidateList raw_candidates, |
| 50 |
FuncCandidateList *candidates); |
| 51 |
|
| 52 |
extern FuncCandidateList func_select_candidate(int nargs, |
| 53 |
Oid *input_typeids, |
| 54 |
FuncCandidateList candidates); |
| 55 |
|
| 56 |
extern void make_fn_arguments(ParseState *pstate, |
| 57 |
List *fargs, |
| 58 |
Oid *actual_arg_types, |
| 59 |
Oid *declared_arg_types); |
| 60 |
|
| 61 |
extern const char *funcname_signature_string(const char *funcname, int nargs, |
| 62 |
List *argnames, const Oid *argtypes); |
| 63 |
extern const char *func_signature_string(List *funcname, int nargs, |
| 64 |
List *argnames, const Oid *argtypes); |
| 65 |
|
| 66 |
extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, |
| 67 |
bool missing_ok); |
| 68 |
extern Oid LookupFuncWithArgs(ObjectType objtype, ObjectWithArgs *func, |
| 69 |
bool missing_ok); |
| 70 |
|
| 71 |
extern void check_srf_call_placement(ParseState *pstate, Node *last_srf, |
| 72 |
int location); |
| 73 |
|
| 74 |
#endif /* PARSE_FUNC_H */ |