Re: Building JSON objects - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Building JSON objects
Date
Msg-id 5515CA39.10606@aklaver.com
Whole thread Raw
In response to Re: Building JSON objects  (Eli Murray <ejmurra2@illinimedia.com>)
List pgsql-general
On 03/27/2015 12:30 PM, Eli Murray wrote:
> Thanks to you all for the replies. Adrian, your solution is working for
> me without errors but it's not actually inserting anything. I'll keep
> fiddling with it and see if I can get what I want but I'm confident now
> that I'm on the right path. As a backup, I did what I wanted to in
> Javascript and wrote it to a file that I serve from my server when users
> request it. Thanks again!

Sorry, as David pointed out I was only working with the SELECT portion
of the query. I tend to break things into smaller subunits and verify
they work before combining. When I worked on your first statements I
realized the SELECT portion was not working, so I started there.

>
> On Fri, Mar 27, 2015 at 1:49 PM, Jan de Visser <jan@de-visser.net
> <mailto:jan@de-visser.net>> wrote:
>
>     On March 27, 2015 11:38:42 AM David G. Johnston wrote:
>      > On Fri, Mar 27, 2015 at 11:31 AM, Jan de Visser
>     <jan@de-visser.net <mailto:jan@de-visser.net>> wrote:
>      > > On March 27, 2015 01:12:52 PM Eli Murray wrote:
>      > > > ERROR:  syntax error at or near "json_build_object"
>      > > > LINE 1: insert into json(data) json_build_object(SELECT
>     DISTINCT dep...
>      > >
>      > > You may want to review the syntax of the INSERT command, i.e.
>     this doesn't
>      > > have anything to do with JSON:
>      > >
>      > > INSERT INTO foo ( bar, baz, quux, froz ) VALUES (NULL, 12,
>     'box', now())
>      >
>      > ​or..
>      >
>      > INSERT INTO json(data) SELECT json_build_object(SELECT DISTINCT
>     dep...)
>      >
>      > ​David J.
>
>     Serves me right for bringing the snark without properly reading the
>     OP :-)
>
>
>
>     --
>     Sent via pgsql-general mailing list (pgsql-general@postgresql.org
>     <mailto:pgsql-general@postgresql.org>)
>     To make changes to your subscription:
>     http://www.postgresql.org/mailpref/pgsql-general
>
>
>
>
> --
> Senior Web Developer at The Daily Illini
> ejmurra2@illinimedia.com <mailto:ejmurra2@illinimedia.com>
> (815) 985-8760


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Deven Phillips
Date:
Subject: Re: Alias field names in foreign data wrapper?
Next
From: Adrian Klaver
Date:
Subject: Re: Alias field names in foreign data wrapper?