I have such jsonb structure in Postgres table: { "res": [123, 223] } and I want to push values into res-array. I don't know how many values there is on array and as jsonb_insert operates on position, so I tried with -1 position:
select jsonb_insert( '{"res": [123, 223]}', '{res,-1}', '333');
jsonb_insert
--------------------------
{"res": [123, 333, 223]}
It does not work. How to push new values to the end of array?
I am using Postgres 9.6