Reputation: 1890
i'm trying to rebuild relations in my DB. I need to "repair" some strings that are stored badly in my table named city_list.
The data:
"Berlin"
"London "
"Kijev "
"Poznan "
I used pgsql function rtrim(string text [, characters text]) in that way:
UPDATE city_list SET city_name=RTrim(city_name);
UPDATE city_list SET city_name=RTrim(city_name, ' ');
Now I have:
"Berlin"
"Londo"
"Kijev"
"Pozna"
Is there way to force rtrim to cut whole " " string from end not every single characters?
Upvotes: 1
Views: 2231
Reputation: 78413
Use regexp_replace()
.
The trim()
function's second argument is the full list of chars to be trimmed.
Upvotes: 4