I'm trying to turn a 1d jsonb array
[1, 2]
into 2d array where its elements are repeated 3 times (the result can be in jsonb)
[[1, 1, 1],
[2, 2, 2]]
My attempt doesn't work
select array(select array_fill(a::text::integer, array[3]))
from jsonb_array_elements('[1,2]'::jsonb) as a;
ERROR: could not find array type for data type integer[]
Maybe it would work in later PG version, but I'm restricted to PG 9.4.8
What are the other ways?