Is there a function or query that could return arrays of different dimensions as a set? For example, I would like to return the values
ARRAY[1]
ARRAY[2,3]
ARRAY[4,5,6]
as
1
2
3
4
5
6
Is there a function or query that could return arrays of different dimensions as a set? For example, I would like to return the values
ARRAY[1]
ARRAY[2,3]
ARRAY[4,5,6]
as
1
2
3
4
5
6
使用unnest()
:
SELECT unnest(arr) AS elem
FROM (
VALUES
(ARRAY[1])
,(ARRAY[2,3])
,(ARRAY[4,5,6])
) t (arr);
按要求退货。
更多细节:
尝试以下查询
select unnest(a) from
(select array[1] as arr union select array[2,3]
union select array[4,5,6]) t
希望这可能会有所帮助:) ..