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 1ubjjX-004aqg-0P for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 17:46:27 +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 1ubjjU-0046RI-UF for pgsql-general@arkaria.postgresql.org; Tue, 15 Jul 2025 17:46:25 +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 1ubjjU-0046QO-JE for pgsql-general@lists.postgresql.org; Tue, 15 Jul 2025 17:46:25 +0000 Received: from mail-oi1-f170.google.com ([209.85.167.170]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ubjjS-007up0-28 for pgsql-general@postgresql.org; Tue, 15 Jul 2025 17:46:24 +0000 Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-40aef72f252so1625132b6e.0 for ; Tue, 15 Jul 2025 10:46:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752601581; x=1753206381; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Nn+uqUcRxAyYAY9w4Vmwgy1TntevD8eX/oTZmjZ59HI=; b=MYpap4KZ45/ME29t1RqYwPpUFnl2SGYsdy8XaCYYfZOV0ijr+t4NqQYkFtn54Sn/TQ NXQbuKBeSCMWrM7Ppcnh3tqcib9zeuwx5pnD33ZzPlwfo8LDrbM6KOy7q4mRkc0QEB44 A/rlfTvbX77odrHIydSCbHAx6A1MJ3sFNW6ldCeVjpIUS+tfeexJuvKVUQuGbHfsn0Vc j/54tRF92IWLJ2jjdRHNKIt7XSDh9BTZrXHYD0KSWBg0BTqjYRhLf3XWs/yG9mAj89pg TmUc8SB6dae1JwoWOskOLSAz/QYRHaUGT0NTRjz6fr8O2G7ERCo6B5E9lB7vGBTYRgl8 GMSw== X-Gm-Message-State: AOJu0YxWaC2SI3Jq/iMv23uOfm1Wiye2rfGR7heZ/hv2n2mYEx/QayqV S3uefxpBJ4SNV4uIjNY350lbcuSfOv7YAIqhJlX2LyEBrrfUHKKKJP0pOAMhn56/nVpS0B1uLoK IsNdLuFhZMIpRtikfIimh0Cnj9JOR3c4= X-Gm-Gg: ASbGncsTPbyEbmLNsatdwAmEr9Yt9MF1+gBZKJ3eom5D9IK6hpaK5gX05fZnCrkuegc 6T6YX/iP6AtbgvAKOC1yS0hh+igdsI4/zg9FnMmLqSouPVB7iYZkisoMazNZIPKVTXzRUnfxnG9 ycpw3F+RZTE75tYLqnht31D/8A3a47QkxuA8KzkTWVC4ZI+FAvZobFfgqq2qAoqzKAKOUpxkntB PVGXv1R X-Google-Smtp-Source: AGHT+IFhouZAExqJvM7jH+10msWEePcvO9T6QIOamoS1Z9CU1xTO8g+AU9hU5MGTElFwX/pxzl7Nse4t+IkPnp4a5Pg= X-Received: by 2002:a05:6808:d47:b0:404:764:f7b6 with SMTP id 5614622812f47-41ba97352e9mr3325499b6e.9.1752601580662; Tue, 15 Jul 2025 10:46:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Thom Brown Date: Tue, 15 Jul 2025 18:46:07 +0100 X-Gm-Features: Ac12FXxUo_CCZsgrDz8Q3a1yiMYHpqIiKtwlxjklGmb0hsgLiVNHJNHXa7GGqfQ Message-ID: Subject: Re: Removing terminal period from varchar string in table column To: Rich Shepard Cc: PGSQL Mailing List Content-Type: multipart/alternative; boundary="000000000000a5f3450639fb5ae2" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a5f3450639fb5ae2 Content-Type: text/plain; charset="UTF-8" On Tue, 15 Jul 2025, 18: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. > There are various options, but perhaps just use rtrim. rtrim(company_name, '.') https://www.postgresql.org/docs/current/functions-string.html Thom --000000000000a5f3450639fb5ae2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 15 Jul 2025, 18:30 Rich Shepard, <= rshepard@appl-ecosys.com> wrote:
I want to remove the terminal period '.' fr= om 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 unsu= re how
best to do this without corrupting the database table.

There are various opt= ions, but perhaps just use rtrim.

rtrim(company_name, '.')