diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2017-02-22 11:10:49 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2017-02-22 11:10:49 -0500 |
commit | 502a3832cc54c7115dacb8a2dae06f0620995ac6 (patch) | |
tree | 60b620acde2bea72fabbdfad7ce02ea9ffcaec54 /src/backend/utils/adt/json.c | |
parent | 4c728f382970b6346142fe4409212063ee3e92dc (diff) | |
download | postgresql-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/json.c')
-rw-r--r-- | src/backend/utils/adt/json.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 { |