Is it possible to trim a text array in PostgreSQL? If so, how?
I want to get something like:
select trim(myTextArrayColumn) from myTable;
where myTextArrayColumn is of type text [].
Example column values:
{"someData1 ", "someData2 "} {" someData3 "}
This should do it:
select array_agg(trim(e)) from ( select row_number() over () as rn, unnest(myTextArrayColumn) e from mytable ) t group by rn
try this i think fits your
select string_to_array(replace(array_to_string(arrColumn, '::'), ' ', ''), '::') from myTable
note : 1. all spaces will be removed 2. your values should not contain "::" if it uses a different delimiter