Subject: Re: Removing terminal period from varchar string in table column

From: Thom Brown <[email-masked]>
Date: Tue, 15 Jul 2025 18:46:07 +0100

On Tue, 15 Jul 2025, 18:30 Rich Shepard, <[email-masked]> 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

---

From: Rich Shepard <[email-masked]>
Date: Tue, 15 Jul 2025 10:59:27 -0700 (PDT)

> There are various options, but perhaps just use rtrim.

Thom,

I looked at rtrim() but didn't see where to specify the table name. Would it
be `select * from table companies rtrim(company_name, '.')'?

Thanks,

Rich