From 502a3832cc54c7115dacb8a2dae06f0620995ac6 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 22 Feb 2017 11:10:49 -0500 Subject: Correctly handle array pseudotypes in to_json and to_jsonb Columns with array pseudotypes have not been identified as arrays, so they have been rendered as strings in the json and jsonb conversion routines. This change allows them to be rendered as json arrays, making it possible to deal correctly with the anyarray columns in pg_stats. --- src/backend/utils/adt/json.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/adt/json.c') diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 628e9de6166..0ed6a10a443 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -1397,9 +1397,10 @@ json_categorize_type(Oid typoid, default: /* Check for arrays and composites */ - if (OidIsValid(get_element_type(typoid))) + if (OidIsValid(get_element_type(typoid)) || typoid == ANYARRAYOID + || typoid == RECORDARRAYOID) *tcategory = JSONTYPE_ARRAY; - else if (type_is_rowtype(typoid)) + else if (type_is_rowtype(typoid)) /* includes RECORDOID */ *tcategory = JSONTYPE_COMPOSITE; else { -- cgit v1.2.3