From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Joao Miguel Ferreira <joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: append jsonb array to another jsonb array |
Date: | 2021-02-17 19:50:17 |
Message-ID: | CAFj8pRAdVkdpo105L3nC5z1cYAaHgHummrVgarn54g6F-yJ1eg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi
st 17. 2. 2021 v 20:44 odesílatel Joao Miguel Ferreira <
joao(dot)miguel(dot)c(dot)ferreira(at)gmail(dot)com> napsal:
> Hello all,
>
> I PL/pgSQL I have a few jsonb variables (instantiated each with an array
> of objects) and I need to append them to produce the final result. All of
> them are small in size (max 30 each). We are using Pg 11.
>
> Example:
> a = [ x, y ]
> b = [ z , w ]
> result would be [ x, y, z, w ]
>
> What would you consider to be a suitable approach ?
>
postgres=# select '[10,20,30]'::jsonb || '[100,20]'::jsonb;
┌───────────────────────┐
│ ?column? │
╞═══════════════════════╡
│ [10, 20, 30, 100, 20] │
└───────────────────────┘
(1 row)
Regards
Pavel
> thanks
> João
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Joao Miguel Ferreira | 2021-02-17 20:52:29 | Re: append jsonb array to another jsonb array |
Previous Message | David G. Johnston | 2021-02-17 19:50:16 | Re: append jsonb array to another jsonb array |