MCPcopy Create free account
hub / github.com/apache/cloudberry / array_replace

Function array_replace

src/backend/utils/adt/arrayfuncs.c:6539–6558  ·  view source on GitHub ↗

* Replace any occurrences of an element in an array */

Source from the content-addressed store, hash-verified

6537 * Replace any occurrences of an element in an array
6538 */
6539Datum
6540array_replace(PG_FUNCTION_ARGS)
6541{
6542 ArrayType *array;
6543 Datum search = PG_GETARG_DATUM(1);
6544 bool search_isnull = PG_ARGISNULL(1);
6545 Datum replace = PG_GETARG_DATUM(2);
6546 bool replace_isnull = PG_ARGISNULL(2);
6547
6548 if (PG_ARGISNULL(0))
6549 PG_RETURN_NULL();
6550 array = PG_GETARG_ARRAYTYPE_P(0);
6551
6552 array = array_replace_internal(array,
6553 search, search_isnull,
6554 replace, replace_isnull,
6555 false, PG_GET_COLLATION(),
6556 fcinfo);
6557 PG_RETURN_ARRAYTYPE_P(array);
6558}
6559
6560/*
6561 * Implements width_bucket(anyelement, anyarray).

Callers

nothing calls this directly

Calls 1

array_replace_internalFunction · 0.85

Tested by

no test coverage detected