Re: BUG #16507: RTRIM function doesnt behave as expected for certain scenario
В списке pgsql-bugs по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #16507: RTRIM function doesnt behave as expected for certain scenario |
| Дата | |
| Msg-id | 2083976.1592849929@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | BUG #16507: RTRIM function doesnt behave as expected for certain scenario (PG Bug reporting form <noreply@postgresql.org>) |
| Список | pgsql-bugs |
PG Bug reporting form <noreply@postgresql.org> writes:
> I am trying to use RTIM function on a String (Column data) to remove some
> character/string from the right end.
> Example -
> select column_name, RTRIM(column_name, '-1') from table_name;
> In case of the first string, RTRIM is removing "1-1" instead of "-1".
> I expect it to remove "-1" as it did in other strings.
Your expectation is wrong, per the function's documentation:
Removes the longest string containing only characters in
'characters' (a space by default) from the end of 'string'.
The example is pretty explicit about this, too:
rtrim('testxxzx', 'xyz') → test
You could do what you want with regexp_replace() or the pattern-matching
variant of substring().
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера