Re: Removing terminal period from varchar string in table column

From: Thom Brown <thom(at)linux(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Removing terminal period from varchar string in table column
Date: 2025-07-15 17:46:07
Message-ID: CAA-aLv4cHmb=0aYm72z=HT93NR6=L8uHVTB92siQONX+7QT6yg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 15 Jul 2025, 18:30 Rich Shepard, <rshepard(at)appl-ecosys(dot)com> wrote:

> I want to remove the terminal period '.' from the varchar strings in the
> 'company_name' column in all rows with that period in the companies table.
>
> I've looked at trim(), translate(), "substr(company_name 1,
> length(compan_name) - 1)", and a couple of other functions and am unsure
> how
> best to do this without corrupting the database table.
>

There are various options, but perhaps just use rtrim.

rtrim(company_name, '.')

https://www.postgresql.org/docs/current/functions-string.html

Thom

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2025-07-15 17:59:27 Re: Removing terminal period from varchar string in table column
Previous Message Jeff Ross 2025-07-15 17:43:17 Re: Removing terminal period from varchar string in table column