Re: Removing terminal period from varchar string in table column

From: Jeff Ross <jross(at)openvistas(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org, rshepard(at)appl-ecosys(dot)com
Subject: Re: Removing terminal period from varchar string in table column
Date: 2025-07-15 17:43:17
Message-ID: f162af83-e2f1-48d0-aec4-e80c2ad4ecb4@openvistas.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/15/25 11:30, Rich Shepard 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.
>
> Advice needed.
>
> TIA,
>
> Rich
>
>
>
How about

test:

    select company_name, replace(company_name,'.','') from companies;

update:

    update companies set company_name = replace(company_name,'.','')
where company_name like '%.';

?

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2025-07-15 17:46:07 Re: Removing terminal period from varchar string in table column
Previous Message Merlin Moncure 2025-07-15 17:32:42 Re: Performance of JSON type in postgres