I'm working with a problem similar to this one: PostgreSQL: concatenate nested arrays with differing element dimensions
In this problem, a user wants to be able to create a multi-dimensional array like:
{{1,2},{3}}
using something like:
SELECT array_cat(
ARRAY[ARRAY[1,2]]
, ARRAY[ARRAY[3]]
)
Erwin Brandsetter says it's not possible without a cheap trick like padding with some dummy value.
I'm wondering if I can approach this problem in a different way to construct a multi-dimensional array. Or some equivalent structure that's basically the same thing. Like constructing some data type to replace the int[] structure. Or possibly use the postgres json feature.
I would preferably like the solution to allow for easy appending/ replacing. Multidimensional array manipulation so far hasn't been fun in postgresql.