Re: numeric data type?
От | Zlatko Matić |
---|---|
Тема | Re: numeric data type? |
Дата | |
Msg-id | 001d01c61f39$d18db5c0$11291dc3@zlatkovyfkpgz6 обсуждение исходный текст |
Ответ на | numeric data type? (Zlatko Matić <zlatko.matic1@sb.t-com.hr>) |
Ответы |
Re: numeric data type?
|
Список | pgsql-general |
Thanks for answer, but in documentation I found that Numeric can be without scale and precision defined: "Specifying NUMERICwithout any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale. (The SQL standard requires a default scale of 0, i.e., coercion to integer precision. We find this a bit useless. If you're concerned about portability, always specify the precision and scale explicitly.) " Talking about float: "If you require exact storage and calculations (such as for monetary amounts), use the numeric type instead. " So, it seems that numeric without parameters (precision, scale) behave similar to float, but is much exact. Am I right or I missunderstood? Thanks, Zlatko ----- Original Message ----- From: "Tony Caduto" <tony.caduto@amsoftwaredesign.com> To: "Zlatko Matić" <zlatko.matic1@sb.t-com.hr> Sent: Saturday, January 21, 2006 5:15 PM Subject: Re: [GENERAL] numeric data type? Zlatko Matić wrote: > Is "numeric" data type good choice for a field that would store integer > values in most cases, but sometimes decimal values as well? > Thanks, > Zlatko > I think you would be better off with a float. numeric has to have a scale set to it, while float4 or float8 does not. -- Tony Caduto AM Software Design Home of PG Lightning Admin for Postgresql http://www.amsoftwaredesign.com
В списке pgsql-general по дате отправления: