aboutsummaryrefslogtreecommitdiff
path: root/src/include/funcapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/funcapi.h')
-rw-r--r--src/include/funcapi.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/funcapi.h b/src/include/funcapi.h
index 951af2aad3d..d2dbc163f29 100644
--- a/src/include/funcapi.h
+++ b/src/include/funcapi.h
@@ -2,6 +2,7 @@
*
* funcapi.h
* Definitions for functions which return composite type and/or sets
+ * or work on VARIADIC inputs.
*
* This file must be included by all Postgres modules that either define
* or call FUNCAPI-callable functions or macros.
@@ -315,4 +316,26 @@ extern void end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx);
PG_RETURN_NULL(); \
} while (0)
+/*----------
+ * Support to ease writing of functions dealing with VARIADIC inputs
+ *----------
+ *
+ * This function extracts a set of argument values, types and NULL markers
+ * for a given input function. This returns a set of data:
+ * - **values includes the set of Datum values extracted.
+ * - **types the data type OID for each element.
+ * - **nulls tracks if an element is NULL.
+ *
+ * variadic_start indicates the argument number where the VARIADIC argument
+ * starts.
+ * convert_unknown set to true will enforce the conversion of arguments
+ * with unknown data type to text.
+ *
+ * The return result is the number of elements stored, or -1 in the case of
+ * "VARIADIC NULL".
+ */
+extern int extract_variadic_args(FunctionCallInfo fcinfo, int variadic_start,
+ bool convert_unknown, Datum **values,
+ Oid **types, bool **nulls);
+
#endif /* FUNCAPI_H */