Converting value to array

Поиск
Список
Период
Сортировка
От Sean Davis
Тема Converting value to array
Дата
Msg-id 001201c50b9d$71c93570$7d75f345@WATSON
обсуждение исходный текст
Ответы Re: Converting value to array  (Michael Fuhr <mike@fuhr.org>)
Re: Converting value to array  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
I have a column in my table block_sizes(varchar) that looks like:
 
12,23,
234,23,
78,64,28,
 
i.e., comma-separated integer values (and the included trailing comma).  I would like to convert these each to an array and store in another column.  However, I haven't been able to get this to work.  I have tried things like:
 
array[rtrim(block_sizes,',')]
'''' || '{' || rtrim(block_sizes,',') || '}' || ''''::int[]
'{' || rtrim(block_sizes,',') || '}'
 
as expressions in an update to the new column (declared as int[]).  However, it seems as if the result of the rtrim is treated differently than the same expression entered directly.  Can someone enlighten me as to how to make this conversion?
 
Thanks,
Sean
 

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Help with subselect (first time)
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Converting value to array