PostgreSQL

时间:2016-09-15 15:55:58

标签: arrays postgresql multidimensional-array nested unnest

给定嵌套数组:

SELECT ARRAY[ARRAY[1, 2, 3], ARRAY[4, 5, 6], ARRAY[7, 8, 9]];
-------------------------------------------------------------
{{1,2,3},{4,5,6},{7,8,9}}

如何将数组拆分成行?

{1,2,3}
{4,5,6}
{7,8,9}

我已尝试unnest,但它适用于内部元素:

SELECT unnest(ARRAY[ARRAY[1, 2, 3], ARRAY[4, 5, 6], ARRAY[7, 8, 9]]);
---------------------------------------------------------------------
1
2
3
4
5
6
7
8
9

0 个答案:

没有答案