functions.h 1.8 KB

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