| From: | Szymon Guz <mabewlun(at)gmail(dot)com> |
|---|---|
| To: | Eli Murray <ejmurra2(at)illinimedia(dot)com> |
| Cc: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, PostgreSQL <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Building JSON objects |
| Date: | 2015-03-27 18:42:07 |
| Message-ID: | CAFjNrYtzjSZwoG+cM2wZHcinSrAPxwQGd8Yi0EY82ipRZaX7Bw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 27 March 2015 at 19:12, Eli Murray <ejmurra2(at)illinimedia(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jan de Visser | 2015-03-27 18:49:17 | Re: Building JSON objects |
| Previous Message | Merlin Moncure | 2015-03-27 18:40:54 | Re: json-patch support? |