Re: json select question

Поиск
Список
Период
Сортировка
Искать
От
John R Pierce
Тема
Re: json select question
Дата
Msg-id
3f9679b6-1a6b-b9b2-d387-cb6b31c3d604@hogranch.com
Ответ на
Список
Дерево обсуждения
json select question CS DBA <cs_dba@consistentstate.com>
Re: json select question "FarjadFarid\(ChkNet\)" <farjad.farid@checknetworks.com>
Re: json select question John R Pierce <pierce@hogranch.com>
On 9/21/2016 4:54 PM, CS DBA wrote:
How can i pull a unique list of all json column names? such as book_name, catalog_name, etc

try json_object_keys() ... https://www.postgresql.org/docs/current/static/functions-json.html

but this will only pull the top level keys, like (from the first row of your example) , book_name, author... it won't pull out any second level fields like first_name, last_name.

you'll likely need to run this on all rows, and do a group by to get what you need.

thats a pretty messy way of storing data, btw, and not very relational, having a key name indicate a record type, and tossing all the record types into the same table.


-- 
john r pierce, recycling bits in santa cruz
В списке pgsql-general по дате отправления
От: Patrick B
Дата:
От: Tom Lane
Дата:
Сообщение: Re: Unstable C Function
FAQ