Converting value to array - Mailing list pgsql-novice

From Sean Davis
Subject Converting value to array
Date
Msg-id 001201c50b9d$71c93570$7d75f345@WATSON
Whole thread Raw
Responses Re: Converting value to array
Re: Converting value to array
List 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 by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Help with subselect (first time)
Next
From: Michael Fuhr
Date:
Subject: Re: Converting value to array