There's a column in my database that's a text column that should be an array column. All of the values of that column are valid Postgres arrays (since they were taken as text values from a Postgres array column) with format like {valuea,valueb}
. I need them as array values however, so how do I convert them back to array values?
You may use ALTER TABLE.. ALTER COLUMN
with the USING
option
alter table t alter column col type text[] using col::text[];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.