我想修剪 a 中每个值的空格text[]
。
如果这只是一个text
专栏我可以做:
update server set tags = rtrim(ltrim(tags));
但是,我该如何为数组执行此操作?否则相同的查询给出错误:
ERROR: function rtrim(text[]) does not exist
LINE 1: update server set tags = ltrim(rtrim(tags));
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
但是,我找到了array_replace
需要替换特定索引的函数。我想我可以为每个数组值找出某种迭代并使用此函数。