Search Postgresql Archives

Re: numeric data type?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx>
To: "Zlatko Matić" <zlatko.matic1@xxxxxxxxxxx>
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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux