[HACKERS] rtrim giving weird result

2001-03-14 Thread G. Anthony Reina
I'm running Postgres 7.0.3 on a RedHat Linux 6.1. For some reason, rtrim is giving me an incorrect result: db01=# SELECT tablename FROM pg_tables WHERE tablename LIKE '%_opto' AND tablename NOT LIKE 'pg%' ORDER BY tablename ASC ; tablename - center_out_opto circles_opto e

Re: [HACKERS] rtrim giving weird result

2001-03-14 Thread Tom Lane
"G. Anthony Reina" <[EMAIL PROTECTED]> writes: > I'm running Postgres 7.0.3 on a RedHat Linux 6.1. For some reason, rtrim > is giving me an incorrect result: No, you have an incorrect understanding of rtrim. The second argument is a set of removable characters, not a string to be matched. AFAIK

Re: [HACKERS] rtrim giving weird result

2001-03-14 Thread Ken Hirsch
is not in the set {o, p, t, _} but all the characters after it are. rtrim("center_out_opto", "pot_") will produce the same thing. - Original Message - From: "G. Anthony Reina" <[EMAIL PROTECTED]> To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]&g

Re: [HACKERS] rtrim giving weird result

2001-03-15 Thread G. Anthony Reina
Ken Hirsch wrote: > So rtrim("center_out_opto", "_opto") returns > "center_ou" > because "u" is not in the set {o, p, t, _} but all the characters after it > are. > rtrim("center_out_opto", "pot_") will produce the same thing. > That seems like an odd definition (although as Tom points out,

Re: [HACKERS] rtrim giving weird result

2001-03-15 Thread Ross J. Reedstrom
On Thu, Mar 15, 2001 at 09:34:04AM -0800, G. Anthony Reina wrote: > Ken Hirsch wrote: > > > So rtrim("center_out_opto", "_opto") returns > > "center_ou" > > because "u" is not in the set {o, p, t, _} but all the characters after it > > are. > > rtrim("center_out_opto", "pot_") will produce th

Re: [HACKERS] rtrim giving weird result

2001-03-15 Thread Tom Lane
"Ross J. Reedstrom" <[EMAIL PROTECTED]> 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,

Re: [HACKERS] rtrim giving weird result

2001-03-15 Thread Ross J. Reedstrom
On Thu, Mar 15, 2001 at 01:18:57PM -0500, Tom Lane wrote: > "Ross J. Reedstrom" <[EMAIL PROTECTED]> 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