Обсуждение: initcap() whitespace bug

Поиск
Список
Период
Сортировка

initcap() whitespace bug

От
"Darrell Walisser"
Дата:
It appears that "'" is being considered as a whitespace (and perhaps other
punctuation, haven't checked myself):

initcap(text) " Convert first letter of each word (whitespace-separated) to
upper case "

Sample SQL: select initcap('grahm''s little angel');

Incorrect Result (Note capital S): 'Grahm'S Little Angel'

Postgresql Version: 7.4.5

Re: initcap() whitespace bug

От
Tom Lane
Дата:
"Darrell Walisser" <dwalisser@mediak.com> writes:
> It appears that "'" is being considered as a whitespace (and perhaps other
> punctuation, haven't checked myself):

Hmm.  The documentation is at variance with the code, which clearly says

 *     Returns string, with first letter of each word in uppercase, all
 *     other letters in lowercase. A word is defined as a sequence of
 *     alphanumeric characters, delimited by non-alphanumeric
 *     characters.

and indeed implements it that way.

It looks like we changed the code to match what Oracle does on
7/27/2003, but forgot to fix the documentation.  Will fix, thanks
for the report.

            regards, tom lane

Re: initcap() whitespace bug

От
Tom Lane
Дата:
I wrote:
> It looks like we changed the code to match what Oracle does on
> 7/27/2003, but forgot to fix the documentation.  Will fix, thanks
> for the report.

Actually, someone already fixed the documentation in CVS tip: see
http://developer.postgresql.org/docs/postgres/functions-string.html

            regards, tom lane