Support more locale-specific formatting options in cash_out().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 6743a878a4e9442a9846d8c270e5028e514d44f3
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-10-30T19:02:58Z
Releases: 9.2.0
Support more locale-specific formatting options in cash_out().

The POSIX spec defines locale fields for controlling the ordering of the
value, sign, and currency symbol in monetary output, but cash_out only
supported a small subset of these options.  Fully implement p/n_sign_posn,
p/n_cs_precedes, and p/n_sep_by_space per spec.  Fix up cash_in so that
it will accept all these format variants.

Also, make sure that thousands_sep is only inserted to the left of the
decimal point, as required by spec.

Per bug #6144 from Eduard Kracmar and discussion of bug #6277.  This patch
includes some ideas from Alexander Lakhin's proposed patch, though it is
very different in detail.

Files

PathChange+/−
src/backend/utils/adt/cash.c modified +134 −32