In my parameterized query I have to unnest arrays with 1 dimension and 2 dimensions:
$1: ARRAY['id1', 'id2']
$2: ARRAY[ARRAY['tag1'], ARRAY['tag2']]
I tried this query:
INSERT INTO table (id, tags)
SELECT * FROM UNNEST ($1::text[], $2::text[][])
But got this error:
column "tags" is of type text[] but expression is of type text
I want the result of SELECT * FROM UNNEST ...
to be 2 rows:
'id1', ARRAY['tag1']
'id2', ARRAY['tag2']