* DatumGetAnyArrayP: return either an expanded array or a detoasted varlena * array. The result must not be modified in-place. */
| 398 | * array. The result must not be modified in-place. |
| 399 | */ |
| 400 | AnyArrayType * |
| 401 | DatumGetAnyArrayP(Datum d) |
| 402 | { |
| 403 | ExpandedArrayHeader *eah; |
| 404 | |
| 405 | /* |
| 406 | * If it's an expanded array (RW or RO), return the header pointer. |
| 407 | */ |
| 408 | if (VARATT_IS_EXTERNAL_EXPANDED(DatumGetPointer(d))) |
| 409 | { |
| 410 | eah = (ExpandedArrayHeader *) DatumGetEOHP(d); |
| 411 | Assert(eah->ea_magic == EA_MAGIC); |
| 412 | return (AnyArrayType *) eah; |
| 413 | } |
| 414 | |
| 415 | /* Else do regular detoasting as needed */ |
| 416 | return (AnyArrayType *) PG_DETOAST_DATUM(d); |
| 417 | } |
| 418 | |
| 419 | /* |
| 420 | * Create the Datum/isnull representation of an expanded array object |
no test coverage detected