* As above, when caller has the ability to cache element type info */
| 369 | * As above, when caller has the ability to cache element type info |
| 370 | */ |
| 371 | ExpandedArrayHeader * |
| 372 | DatumGetExpandedArrayX(Datum d, ArrayMetaState *metacache) |
| 373 | { |
| 374 | /* If it's a writable expanded array already, just return it */ |
| 375 | if (VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(d))) |
| 376 | { |
| 377 | ExpandedArrayHeader *eah = (ExpandedArrayHeader *) DatumGetEOHP(d); |
| 378 | |
| 379 | Assert(eah->ea_magic == EA_MAGIC); |
| 380 | /* Update cache if provided */ |
| 381 | if (metacache) |
| 382 | { |
| 383 | metacache->element_type = eah->element_type; |
| 384 | metacache->typlen = eah->typlen; |
| 385 | metacache->typbyval = eah->typbyval; |
| 386 | metacache->typalign = eah->typalign; |
| 387 | } |
| 388 | return eah; |
| 389 | } |
| 390 | |
| 391 | /* Else expand using caller's cache if any */ |
| 392 | d = expand_array(d, CurrentMemoryContext, metacache); |
| 393 | return (ExpandedArrayHeader *) DatumGetEOHP(d); |
| 394 | } |
| 395 | |
| 396 | /* |
| 397 | * DatumGetAnyArrayP: return either an expanded array or a detoasted varlena |
nothing calls this directly
no test coverage detected