aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonb.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2017-02-22 11:10:49 -0500
committerAndrew Dunstan <andrew@dunslane.net>2017-02-22 11:10:49 -0500
commit502a3832cc54c7115dacb8a2dae06f0620995ac6 (patch)
tree60b620acde2bea72fabbdfad7ce02ea9ffcaec54 /src/backend/utils/adt/jsonb.c
parent4c728f382970b6346142fe4409212063ee3e92dc (diff)
downloadpostgresql-502a3832cc54c7115dacb8a2dae06f0620995ac6.tar.gz
postgresql-502a3832cc54c7115dacb8a2dae06f0620995ac6.zip
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.
Diffstat (limited to 'src/backend/utils/adt/jsonb.c')
-rw-r--r--src/backend/utils/adt/jsonb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c
index b9bf18ffe5d..5b6178badf9 100644
--- a/src/backend/utils/adt/jsonb.c
+++ b/src/backend/utils/adt/jsonb.c
@@ -644,9 +644,10 @@ jsonb_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 = JSONBTYPE_ARRAY;
- else if (type_is_rowtype(typoid))
+ else if (type_is_rowtype(typoid)) /* includes RECORDOID */
*tcategory = JSONBTYPE_COMPOSITE;
else
{