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
 ellipse_opto
 ex_ellipse_opto
 figure8_opto
 ro_ellipse_opto
(6 rows)

Now I want to return the same thing only with the trailing '_opto'
removed:


db01=# SELECT rtrim(tablename, '_opto') FROM pg_tables WHERE tablename
LIKE '%_opto' AND tablename NOT LIKE 'pg%'  ORDER BY tablename ASC ;
   rtrim
------------
 center_ou                                     <=======================
NOTE: the trailing 't' is missing
 circles
 ellipse
 ex_ellipse
 figure8
 ro_ellipse
(6 rows)

However, as you can see, the 'center_out' table is missing the last 't'.
If I exclude the '_':

db01=# SELECT rtrim(tablename, 'opto') FROM pg_tables WHERE tablename
LIKE '%_opto' AND tablename NOT LIKE 'pg%'  ORDER BY tablename ASC ;
    rtrim
-------------
 center_out_
<=======================   't' shows up again
 circles_
 ellipse_
 ex_ellipse_
 figure8_
 ro_ellipse_
(6 rows)

The 't' is back.

Is there something that I'm doing wrong with my query here?

Thanks.
-Tony






---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to