codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * functions.h4 * Declarations for execution of SQL-language functions.5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/executor/functions.h11 *12 *-------------------------------------------------------------------------13 */14#ifndef FUNCTIONS_H15#define FUNCTIONS_H16 17#include "nodes/execnodes.h"18#include "tcop/dest.h"19 20/*21 * Data structure needed by the parser callback hooks to resolve parameter22 * references during parsing of a SQL function's body. This is separate from23 * SQLFunctionCache since we sometimes do parsing separately from execution.24 */25typedef struct SQLFunctionParseInfo26{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 35typedef SQLFunctionParseInfo *SQLFunctionParseInfoPtr;36 37extern Datum fmgr_sql(PG_FUNCTION_ARGS);38 39extern SQLFunctionParseInfoPtr prepare_sql_fn_parse_info(HeapTuple procedureTuple,40 Node *call_expr,41 Oid inputCollation);42 43extern void sql_fn_parser_setup(struct ParseState *pstate,44 SQLFunctionParseInfoPtr pinfo);45 46extern void check_sql_fn_statements(List *queryTreeLists);47 48extern bool check_sql_fn_retval(List *queryTreeLists,49 Oid rettype, TupleDesc rettupdesc,50 bool insertDroppedCols,51 List **resultTargetList);52 53extern bool check_sql_fn_retval_ext(List *queryTreeLists,54 Oid rettype, TupleDesc rettupdesc,55 char prokind,56 bool insertDroppedCols,57 List **resultTargetList);58 59extern DestReceiver *CreateSQLFunctionDestReceiver(void);60 61#endif /* FUNCTIONS_H */62 