Search Postgresql Archives

Re: How to stop array_to_json from interpolating column names that weren't there

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jul 19, 2017, at 20:47 , Paul Jungwirth <pj@xxxxxxxxxxxxxxxxxxxxxxxx> 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?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux