Re: monetary bug

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: monetary bug
Дата
Msg-id 20040823104535.GB17568@zf.jcu.cz
обсуждение исходный текст
Ответ на Re: monetary bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: monetary bug  (Dennis Bjorklund <db@zigo.dhs.org>)
Список pgsql-hackers
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/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Eyinagho Newton
Дата:
Сообщение: Re: Installing PostgreSQL in a Unix Platform
Следующее
От: Dennis Bjorklund
Дата:
Сообщение: Re: monetary bug