Re: rtrim giving weird result

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: rtrim giving weird result
Date: 2001-03-15 18:18:57
Message-ID: 14489.984680337@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Ross J. Reedstrom" <reedstrm(at)rice(dot)edu> writes:
>> Is there a way to just remove the "_opto" from the end of the string?

> If you have exactly one known string to (optionally) remove, this works
> (and even works if the string is missing. Watch out for the early
> occurance of substring problem, though!):

> test=# select substr('center_out_opto',1,(strpos('center_out_opto','_opto')-1));

My first thought for any moderately complicated string-bashing problem
is to write a function in pltcl or plperl ... they are much stronger in
string manipulation than SQL itself is.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 2001-03-15 18:37:02 Re: rtrim giving weird result
Previous Message Peter Eisentraut 2001-03-15 18:17:20 Re: Allowing WAL fsync to be done via O_SYNC