| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* functions.h |
| 4 |
* Declarations for execution of SQL-language functions. |
| 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/executor/functions.h |
| 11 |
* |
| 12 |
*------------------------------------------------------------------------- |
| 13 |
*/ |
| 14 |
#ifndef FUNCTIONS_H |
| 15 |
#define FUNCTIONS_H |
| 16 |
|
| 17 |
#include "nodes/execnodes.h" |
| 18 |
#include "tcop/dest.h" |
| 19 |
|
| 20 |
/* |
| 21 |
* Data structure needed by the parser callback hooks to resolve parameter |
| 22 |
* references during parsing of a SQL function's body. This is separate from |
| 23 |
* SQLFunctionCache since we sometimes do parsing separately from execution. |
| 24 |
*/ |
| 25 |
typedef struct SQLFunctionParseInfo |
| 26 |
{ |
| 27 |
char *fname; /* function's name */ |
| 28 |
int nargs; /* number of input arguments */ |
| 29 |
Oid *argtypes; /* resolved types of input arguments */ |
| 30 |
char **argnames; /* names of input arguments; NULL if none */ |
| 31 |
/* Note that argnames[i] can be NULL, if some args are unnamed */ |
| 32 |
Oid collation; /* function's input collation, if known */ |
| 33 |
} SQLFunctionParseInfo; |
| 34 |
|
| 35 |
typedef SQLFunctionParseInfo *SQLFunctionParseInfoPtr; |
| 36 |
|
| 37 |
extern Datum fmgr_sql(PG_FUNCTION_ARGS); |
| 38 |
|
| 39 |
extern SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple, |
| 40 |
Node *call_expr, |
| 41 |
Oid inputCollation); |
| 42 |
|
| 43 |
extern void sql_fn_parser_setup(struct ParseState *pstate, |
| 44 |
SQLFunctionParseInfoPtr pinfo); |
| 45 |
|
| 46 |
extern void check_sql_fn_statements(List *queryTreeLists); |
| 47 |
|
| 48 |
extern bool check_sql_fn_retval(List *queryTreeLists, |
| 49 |
Oid rettype, TupleDesc rettupdesc, |
| 50 |
char prokind, |
| 51 |
bool insertDroppedCols); |
| 52 |
|
| 53 |
extern DestReceiver *CreateSQLFunctionDestReceiver(void); |
| 54 |
|
| 55 |
#endif /* FUNCTIONS_H */ |