如何更新作为字符串数组的列以将每个字符串转换为小写?
像这样将列的所有值更新为小写,但对于字符串数组。
数据示例:
id | tags
---+---------------------------------------------------------------
58 |
87 | {Pasta}
94 | {trendy,Supper,"Restaurant casual"}
...
Run Code Online (Sandbox Code Playgroud)
您可以将数组转换为文本,对其进行应用lower(),然后将其转换回数组:
update the_table
set tags = lower(tags::text)::text[];
Run Code Online (Sandbox Code Playgroud)