I have two columns, material_size
(text
type) and material_size_temp
(text[]
array type).
When I ran UPDATE parts SET material_size_temp[0] = material_size;
I would get values like [0:0]={".021 x 2.450"}
instead of {".021 x 2.450"}
.
How do I clone the text
type column to text[]
array type column?
asked Mar 16, 2015 at 19:11
1 Answer 1
I was close, unlike JavaScript and PHP it seems PostgreSQL array key numbers start with 1, not 0.
UPDATE parts SET material_size_temp[1] = material_size;
answered Mar 16, 2015 at 19:22
lang-sql
material_size_temp
(the whole array) or just the first element? Or do you want to prepend the array with the text frommaterial_size
?