Re: Building JSON objects

Поиск
Список
Период
Сортировка
От Szymon Guz
Тема Re: Building JSON objects
Дата
Msg-id CAFjNrYtzjSZwoG+cM2wZHcinSrAPxwQGd8Yi0EY82ipRZaX7Bw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Building JSON objects  (Eli Murray <ejmurra2@illinimedia.com>)
Список pgsql-general


On 27 March 2015 at 19:12, Eli Murray <ejmurra2@illinimedia.com> wrote:
I'm running psql --version 9.4.1

Also, it may be worth noting that rawdata.deptname and rawdata.deptcode are both text data types.

The errors I'm getting are: 

ERROR:  syntax error at or near "json_build_object"
LINE 1: insert into json(data) json_build_object(SELECT DISTINCT dep...

and

ERROR:  syntax error at or near "row_to_json"
LINE 1: insert into json(data) row_to_json(SELECT DISTINCT deptname,...


Yea, because the insert syntax is a little bit different, try this:

insert into json(data) SELECT json_build...
or
insert into json(data) SELECT row_to_json...

regards,
Szymon

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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: json-patch support?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Building JSON objects