I want to trim spaces from each value in a text[]
.
If this was just a text
column I could do:
update server set tags = rtrim(ltrim(tags));
However how do I do this for an array? As otherwise that same query gives an error of:
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.
I have found thearray_replace
function however that requires a specific index to replace. I guess I could figure out some kind of iteration for each array value and use this function.
tags
into a separate table