Re: 'currency' question; precision/decimal meaing

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: 'currency' question; precision/decimal meaing
Дата
Msg-id 20001113101411.B30018@gruby
обсуждение исходный текст
Ответ на 'currency' question; precision/decimal meaing  ("Will Fitzgerald" <fitzgerald@inetmi.com>)
Ответы Re: 'currency' question; precision/decimal meaing
Re: 'currency' question; precision/decimal meaing
Список pgsql-general
On Fri, Nov 10, 2000 at 01:13:23PM -0500, Will Fitzgerald wrote:
> I want to store prices in a table. What's the best way to do this (since
> 'money' is deprecated)?

use int4 (or int8) and assume that the value is multipied by 100 (or another
value - depends on your local currency.
for example:
$400
i will store as
40000
$2.34
i will store as
234

this is much better, and safer than useing floating point fields.

depesz

--
hubert depesz lubaczewski
------------------------------------------------------------------------
     najwspanialszą rzeczą jaką dało nam nowoczesne społeczeństwo,
      jest niesamowita wręcz łatwość unikania kontaktów z nim ...

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

Предыдущее
От: Denis Perchine
Дата:
Сообщение: Problems during doing reindex on 7.0.3
Следующее
От: igor
Дата:
Сообщение: Sequences in transaction