MCPcopy Create free account
hub / github.com/documentdb/documentdb / ArrayExtractDatums

Function ArrayExtractDatums

pg_documentdb_core/src/utils/list_utils.c:237–254  ·  view source on GitHub ↗

* ArrayExtractDatums extracts Datums of given type from given array. */

Source from the content-addressed store, hash-verified

235 * ArrayExtractDatums extracts Datums of given type from given array.
236 */
237void
238ArrayExtractDatums(ArrayType *array, Oid elemType,
239 Datum **elems, bool **nulls, int *nelems)
240{
241 HeapTuple typeTup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(elemType));
242 if (!HeapTupleIsValid(typeTup))
243 {
244 ereport(ERROR, (errmsg("cache lookup failed for type %u", elemType)));
245 }
246
247 Form_pg_type typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
248
249 deconstruct_array(array, elemType, typeStruct->typlen,
250 typeStruct->typbyval, typeStruct->typalign,
251 elems, nulls, nelems);
252
253 ReleaseSysCache(typeTup);
254}

Calls

no outgoing calls

Tested by

no test coverage detected