491{
492 ArrayType *v = DatumGetArrayTypeP(array);
493 Oid element_type = ARR_ELEMTYPE(v);
494 int *dim;
495 int ndim;
496 int nitems;
498 Datum *elements;
499 bool *nulls;
500 int16 typlen;
501 bool typbyval;
502 char typalign;
504 Oid outfuncoid;
505
506 ndim = ARR_NDIM(v);
507 dim = ARR_DIMS(v);
508 nitems = ArrayGetNItems(ndim, dim);
509
510 if (nitems <= 0)
511 {
512 appendStringInfoString(
result,
"[]");
513 return;
514 }
515
516 get_typlenbyvalalign(element_type,
517 &typlen, &typbyval, &typalign);
518
520 &tcategory, &outfuncoid);
521
522 deconstruct_array(v, element_type, typlen, typbyval,
523 typalign, &elements, &nulls,
524 &nitems);
525
527 outfuncoid, use_line_feeds);
528
529 pfree(elements);
530 pfree(nulls);
531}
char result[OUT_DOUBLE_BUFFER_SIZE]
static void json_categorize_type(Oid typoid, JsonTypeCategory *tcategory, Oid *outfuncoid)
static void array_dim_to_json(StringInfo result, int dim, int ndims, int *dims, Datum *vals, bool *nulls, int *valcount, JsonTypeCategory tcategory, Oid outfuncoid, bool use_line_feeds)