public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Removing terminal period from varchar string in table column
2+ messages / 2 participants
[nested] [flat]

* Re: Removing terminal period from varchar string in table column
@ 2025-07-15 17:46 Thom Brown <[email protected]>
  2025-07-15 17:59 ` Re: Removing terminal period from varchar string in table column Rich Shepard <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Thom Brown @ 2025-07-15 17:46 UTC (permalink / raw)
  To: Rich Shepard <[email protected]>; +Cc: pgsql-general

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Removing terminal period from varchar string in table column
  2025-07-15 17:46 Re: Removing terminal period from varchar string in table column Thom Brown <[email protected]>
@ 2025-07-15 17:59 ` Rich Shepard <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Rich Shepard @ 2025-07-15 17:59 UTC (permalink / raw)
  To: pgsql-general

On Tue, 15 Jul 2025, Thom Brown wrote:

> There are various options, but perhaps just use rtrim.
> rtrim(company_name, '.')

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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-07-15 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-15 17:46 Re: Removing terminal period from varchar string in table column Thom Brown <[email protected]>
2025-07-15 17:59 ` Rich Shepard <[email protected]>

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