From jross@openvistas.net Fri May 15 23:22:27 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubjgb-004aHt-Jw for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 17:43:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ubjgZ-00435h-JL for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 17:43:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubjgZ-00435Z-8X for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 17:43:23 +0000 Received: from luna.openvistas.net ([207.158.15.156] helo=openvistas.net) by magus.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1ubjgX-007unc-0E for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 17:43:23 +0000 Received: (qmail 3015 invoked from network); 15 Jul 2025 17:43:18 -0000 Received: from unknown (HELO ?10.0.26.96?) (jross@154.27.111.134) de/crypted with TLSv1.3: AEAD-AES128-GCM-SHA256 [128/128] DN=none by mail.openvistas.net with ESMTPSA; 15 Jul 2025 17:43:18 -0000 Content-Type: multipart/alternative; boundary="------------53ZbYKKIYa9r7RJKHi1te0yp" Message-ID: Date: Tue, 15 Jul 2025 11:43:17 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Removing terminal period from varchar string in table column Content-Language: en-US To: pgsql-general@lists.postgresql.org, rshepard@appl-ecosys.com References: From: Jeff Ross In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------53ZbYKKIYa9r7RJKHi1te0yp Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------53ZbYKKIYa9r7RJKHi1te0yp Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

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

--------------53ZbYKKIYa9r7RJKHi1te0yp-- From rshepard@appl-ecosys.com Fri May 15 23:23:12 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubjyt-004eP9-Kl for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 18:02:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ubjyr-004HWF-Hu for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 18:02:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubjyr-004HW7-7T for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 18:02:17 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubjyp-007v3v-2H for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 18:02:17 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 0A90A2A14D6 for ; Tue, 15 Jul 2025 11:02:14 -0700 (PDT) Date: Tue, 15 Jul 2025 11:02:14 -0700 (PDT) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Removing terminal period from varchar string in table column In-Reply-To: Message-ID: <512c9d0-442d-5bb4-bd26-6b7d222c8235@appl-ecosys.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 15 Jul 2025, Jeff Ross wrote: > 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, These contain the table and column names I didn't see in web page examples. Using update looks better to me. Many thanks, Rich