Unclear documentation of to_char()

Поиск
Список
Период
Сортировка
Искать
От
Peter Eisentraut
Тема
Unclear documentation of to_char()
Дата
Msg-id
Pine.LNX.4.44.0302232038310.1618-100000@peter.localdomain
Список
The documentation of to_char() is unclear regarding the meaning of the
various formatting patterns for plus and minus signs:

S	negative value with minus sign (uses locale)
MI	minus sign in specified position (if number < 0)
PL	plus sign in specified position (if number > 0)
SG	plus/minus sign in specified position

Here is what happens: (The quotes in the result are not actually part of
the function result.)

to_char(485.8, 'S9999.999')		' +485.800'
to_char(485.8, 'MI9999.999')		'   485.800'
to_char(485.8, 'PL9999.999')		'+ 485.800'
to_char(485.8, 'SG9999.999')		'+ 485.800'

to_char(-485.8, 'S9999.999')		' -485.800'
to_char(-485.8, 'MI9999.999')		'- 485.800'
to_char(-485.8, 'PL9999.999')		'  -485.800'
to_char(-485.8, 'SG9999.999')		'- 485.800'

to_char(485.8, '9999.999S')		' 485.800+'
to_char(485.8, '9999.999PL')		' 485.800+'
to_char(485.8, '9999.999MI')		'  485.800 '
to_char(485.8, '9999.999SG')		' 485.800+'

to_char(-485.8, '9999.999S')		' 485.800-'
to_char(-485.8, '9999.999PL')		' -485.800 '
to_char(-485.8, '9999.999MI')		' 485.800-'
to_char(-485.8, '9999.999SG')		' 485.800-'

The SG seems to work okay, and the S could be considered okay if the
documentation were adjusted, but I suspect there are a few bugs in PL and
MI.

-- 
Peter Eisentraut   peter_e@gmx.net



В списке pgsql-hackers по дате отправления
От: Rod Taylor
Дата:
Сообщение: Re: locking mechanism
От: Dave Page
Дата:
Сообщение: Re: Linking to "current" docs
FAQ