Re: String trim function - possible bug?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: String trim function - possible bug?
Дата
Msg-id 20070606102643.H30214@megazone.bigpanda.com
обсуждение исходный текст
Ответ на String trim function - possible bug?  ("Woody Woodring" <george.woodring@iglass.net>)
Ответы Re: String trim function - possible bug?  ("Woody Woodring" <george.woodring@iglass.net>)
Список pgsql-general
On Wed, 6 Jun 2007, Woody Woodring wrote:

> I am seeing weirdness using the trim function on a string:
>
> This works as expected:
>
> SELECT 'dhct:bn', trim(leading 'dhct:' from 'dhct:bn');
>  ?column? | ltrim
> ----------+-------
>  dhct:bn  | bn
> (1 row)
>
> However it fails for these cases:
>
> SELECT 'dhct:dn', trim(leading 'dhct:' from 'dhct:dn');
>  ?column? | ltrim
> ----------+-------
>  dhct:dn  | n
> (1 row)

The 8.2 docs give this as the description in the table:
"Remove the longest string containing only the characters (a space by
default) from the start/end/both ends of the string"

That implies that with characters 'dhct:' the string to remove is 'dhct:d'
because that's the longest leading string made up of those characters.

Maybe a form using something like regexp_replace might work better for
you.

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: String trim function - possible bug?
Следующее
От: "Woody Woodring"
Дата:
Сообщение: Re: String trim function - possible bug?