The following is a snippet of a table called "containers".
Column | Type | Modifiers
--------------------+-----------------------------+---------------------------------
id | uuid | not null
name | character varying(255) |
products | character varying | default '{}'::character varying
How can I alter the products
column to "character varying[]"
and the corresponding modifiers to default '{}'::character varying[]
? Essentially, I want to convert a string to a string array. Note the products column has no limit on the number of characters.
alter table "containers" alter "products" type character varying[];
throws the following error
ERROR: column "products" cannot be cast to type character varying[]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…