Re: How to split an array into columns

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: How to split an array into columns
Дата
Msg-id e61c1c80-19e4-6403-a4d5-f9b18c50988d@gmx.net
обсуждение исходный текст
Ответ на How to split an array into columns  ("a" <372660931@qq.com>)
Ответы Re: How to split an array into columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
a schrieb am 24.08.2018 um 11:01:
> Say if I have an float8 array:
> 
> id| data
> --|---------------
> a | {1,2}
> b | {2,4}
> 
> If I could using query to make it looks like this:
> 
> id| data[1] | data[2]
> --|----------|-----------
> a |      1      |     2
> b |      2      |     4
> 
> Since I would have around 200,000 rows, I would prefer it having
> enough capacity to carry out the calculation such as sum().

Maybe I am missing something, but: 

   select id, data[1], data[2]
   from the_table;

will work just fine. 



В списке pgsql-general по дате отправления:

Предыдущее
От: "a"
Дата:
Сообщение: How to split an array into columns
Следующее
От: Naveen Dabas
Дата:
Сообщение: Re: pg_sample