Search Postgresql Archives

Re: append jsonb array to another jsonb array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

st 17. 2. 2021 v 20:44 odesílatel Joao Miguel Ferreira <joao.miguel.c.ferreira@xxxxxxxxx> 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux