Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there

Поиск
Список
Период
Сортировка
От Guyren Howe
Тема Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there
Дата
Msg-id 76B466D4-616D-4E8C-A98D-1C03250144AC@gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Ответы Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there
Список pgsql-general
On Jul 19, 2017, at 20:47 , Paul Jungwirth <pj@illuminatedcomputing.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?

В списке pgsql-general по дате отправления:

Предыдущее
От: Paul Jungwirth
Дата:
Сообщение: Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] How to stop array_to_json from interpolating columnnames that weren't there