Re: Add json_object(text[], json[])? - Mailing list pgsql-hackers

From Paul A Jungwirth
Subject Re: Add json_object(text[], json[])?
Date
Msg-id CA+renyVEcQ-kVkL+N4jwhrycfsGCgFz_RD6CD=8oMeuRA9EgCQ@mail.gmail.com
Whole thread Raw
In response to Re: Add json_object(text[], json[])?  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
Responses Re: Add json_object(text[], json[])?
List pgsql-hackers
On Thu, Oct 24, 2019 at 8:45 AM Nikita Glukhov <n.gluhov@postgrespro.ru> wrote:
> You can simply use jsonb_object_agg() to build a jsonb object from a sequence
> of transformed key-value pairs:

<strikes forehead> I've even used that function before. :-) I tried
finding it on the JSON functions page but couldn't, so I thought maybe
I was going crazy. Of course it's on the aggregates page instead. As I
said it was late at night. :-) Your version works perfectly!

Even still, it may be nice to have a non-aggregate function that lets
you build nested JSON. But I agree jsonb_object_agg makes it less
needful.

Thanks!
Paul



pgsql-hackers by date:

Previous
From: Paul A Jungwirth
Date:
Subject: Re: Add json_object(text[], json[])?
Next
From: Tom Lane
Date:
Subject: Re: v12.0: ERROR: could not find pathkey item to sort