On Sun, Aug 22, 2004 at 04:07:17PM -0400, Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Tom Lane wrote:
> >> We keep hoping someone will step up to the plate and rewrite it,
> >> instead. Per previous discussion, the type really ought to be a thin
> >> layer over "numeric", with most likely no operations of its own
> >> except I/O conversion.
>
> > And what would it do with it? Add a currency symbol? Which one? Which
> > form? Where? Format the numbers some way?
I'm sure you found answers in "struct lconv" (locale.h), but you'reright (IMHO) better is if datetypes are
independenton format.
What support some argument definition in column definition, somethinglike:
CREATE TABLE tab ( -- curret built-in datetype in/out format num numeric,
-- default user defined format num2 numeric WITH FORMAT,
-- column specific format payme numeric WITH FORMAT='L 999D99', temperature
numeric WITH FORMAT='999D999 C', );
where format producer for datetype is possible (re)define by: CREATE FORMATTER FOR numeric DEFAULT format
INPUTfuncname OUTPUT funcname;
The columns without "FORMAT" options will use standard (current) in/outmethods. Outputs without connection to some
table column can beformated by:
-- curret built-in datetype in/out format SELECT expr;
-- default defined format SELECT FORMAT( expr ); -- specific format SELECT FORMAT( expr AS 'DD/MM/YYYY' );
I think it's pretty extendable solution in contrast to the currenthardcoded in/out datetypes functions.
Comments?
Is there any plan for locale-per-column setting syntax?
> The idea behind the money type is to format per the lc_monetary locale
> setting, which seems perfectly reasonable to me. Further down the road
Why "money" and why not others things like temperature, speed, weight,...?
Karel
-- Karel Zak <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/