| From: | Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com> |
|---|---|
| To: | Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> |
| Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Add json_object(text[], json[])? |
| Date: | 2019-10-24 16:46:12 |
| Message-ID: | CA+renyVEcQ-kVkL+N4jwhrycfsGCgFz_RD6CD=8oMeuRA9EgCQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Oct 24, 2019 at 8:45 AM Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2019-10-24 16:51:07 | Re: v12.0: ERROR: could not find pathkey item to sort |
| Previous Message | Paul A Jungwirth | 2019-10-24 16:37:30 | Re: Add json_object(text[], json[])? |