1 /*-------------------------------------------------------------------------
4 * Declarations for execution of SQL-language functions.
7 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/executor/functions.h
12 *-------------------------------------------------------------------------
17 #include "nodes/execnodes.h"
18 #include "tcop/dest.h"
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.
25 typedef struct SQLFunctionParseInfo
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
;
35 typedef SQLFunctionParseInfo
*SQLFunctionParseInfoPtr
;
37 extern Datum
fmgr_sql(PG_FUNCTION_ARGS
);
39 extern SQLFunctionParseInfoPtr
prepare_sql_fn_parse_info(HeapTuple procedureTuple
,
43 extern void sql_fn_parser_setup(struct ParseState
*pstate
,
44 SQLFunctionParseInfoPtr pinfo
);
46 extern void check_sql_fn_statements(List
*queryTreeLists
);
48 extern bool check_sql_fn_retval(List
*queryTreeLists
,
49 Oid rettype
, TupleDesc rettupdesc
,
50 bool insertDroppedCols
,
51 List
**resultTargetList
);
53 extern DestReceiver
*CreateSQLFunctionDestReceiver(void);
55 #endif /* FUNCTIONS_H */