From: | Guyren Howe <guyren(at)gmail(dot)com> |
---|---|
To: | Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to stop array_to_json from interpolating column names that weren't there |
Date: | 2017-07-20 03:53:06 |
Message-ID: | 76B466D4-616D-4E8C-A98D-1C03250144AC@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Jul 19, 2017, at 20:47 , Paul Jungwirth <pj(at)illuminatedcomputing(dot)com> wrote:
>
>> which is great. I have an array of perfect JSON objects. Now I just need
>> to turn that into a single JSON object.
>
> I think you're saying you want it as a single JSON *array*, right? An object of objects doesn't make sense. Assuming that's right, this seems to work:
>
> db1=# select json_agg(schemata) from schemata;
> json_agg
> ----------------------------------------------------------------------------------------------------------
> [{“catalog_name":"db1","schema_name":"information_schema","schema_name_address":"/information_schema"},
Thanks. Seeking greater understanding, why is json_agg(*) not equivalent?
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-07-20 04:28:59 | Re: How to stop array_to_json from interpolating column names that weren't there |
Previous Message | Paul Jungwirth | 2017-07-20 03:47:19 | Re: How to stop array_to_json from interpolating column names that weren't there |