public inbox for [email protected]  
help / color / mirror / Atom feed
From: Thom Brown <[email protected]>
To: Rich Shepard <[email protected]>
Cc: PGSQL Mailing List <[email protected]>
Subject: Re: Removing terminal period from varchar string in table column
Date: Tue, 15 Jul 2025 18:46:07 +0100
Message-ID: <CAA-aLv4cHmb=0aYm72z=HT93NR6=L8uHVTB92siQONX+7QT6yg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Removing terminal period from varchar string in table column
  In-Reply-To: <CAA-aLv4cHmb=0aYm72z=HT93NR6=L8uHVTB92siQONX+7QT6yg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox