+ FunctionCallInfoData locfcinfo;
+ oidvector *result;
+
+ /*
+ * Normally one would call array_recv() using DirectFunctionCall3, but
+ * that does not work since array_recv wants to cache some data using
+ * fcinfo->flinfo->fn_extra. So we need to pass it our own flinfo
+ * parameter.
+ */
+ InitFunctionCallInfoData(locfcinfo, fcinfo->flinfo, 3,
+ InvalidOid, NULL, NULL);
+
+ locfcinfo.arg[0] = PointerGetDatum(buf);
+ locfcinfo.arg[1] = ObjectIdGetDatum(OIDOID);
+ locfcinfo.arg[2] = Int32GetDatum(-1);
+ locfcinfo.argnull[0] = false;
+ locfcinfo.argnull[1] = false;
+ locfcinfo.argnull[2] = false;
+
+ result = (oidvector *) DatumGetPointer(array_recv(&locfcinfo));
+
+ Assert(!locfcinfo.isnull);
+
+ /* sanity checks: oidvector must be 1-D, 0-based, no nulls */
+ if (ARR_NDIM(result) != 1 ||
+ ARR_HASNULL(result) ||
+ ARR_ELEMTYPE(result) != OIDOID ||
+ ARR_LBOUND(result)[0] != 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
+ errmsg("invalid oidvector data")));
+
+ /* check length for consistency with oidvectorin() */
+ if (ARR_DIMS(result)[0] > FUNC_MAX_ARGS)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("oidvector has too many elements")));