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