Search Postgresql Archives

Re: Building JSON objects

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

 





On 27 March 2015 at 19:12, Eli Murray <ejmurra2@xxxxxxxxxxxxxxx> 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

[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