Re: Money casting too liberal?
От | Michael Nolan |
---|---|
Тема | Re: Money casting too liberal? |
Дата | |
Msg-id | CAOzAquKeu+9MKU+8PXdVTsb258YhiJvPsBKWdJrUc6EreufStw@mail.gmail.com обсуждение исходный текст |
Ответ на | Money casting too liberal? (Steve Crawford <scrawford@pinpointresearch.com>) |
Ответы |
Re: Money casting too liberal?
|
Список | pgsql-general |
On 3/27/13, Steve Crawford <scrawford@pinpointresearch.com> wrote: > Somewhat more worrisome is the fact that it automatically rounds input > (away from zero) to fit. > > select '123.456789'::money; > money > --------- > $123.46 So does casting to an integer: select 1.25::integer ; int4 ---- 1 And then there's this: create table wkdata (numval numeric(5,2)) CREATE TABLE Time: 6.761 ms nolan=> insert into wkdata nolan-> values (123.456789); INSERT 569625265 1 Time: 4.063 ms nolan=> select * from wkdata; select * from wkdata; numval ------ 123.46 So rounding a money field doesn't seem inconsistent with other data types. -- Mike Nolan
В списке pgsql-general по дате отправления: