rtrim giving weird result

Поиск
Список
Период
Сортировка
От G. Anthony Reina
Тема rtrim giving weird result
Дата
Msg-id 3AB02573.41BD00F8@nsi.edu
обсуждение исходный текст
Ответы Re: rtrim giving weird result  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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_optocircles_optoellipse_optoex_ellipse_optofigure8_optoro_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 missingcirclesellipseex_ellipsefigure8ro_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 againcircles_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







В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Re: Small bug in pg_dump
Следующее
От: Tom Lane
Дата:
Сообщение: Re: rtrim giving weird result