Re: numeric data type?

From: Zlatko Matić <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
To: <pgsql-general(at)postgresql(dot)org>, "Tony Caduto" <tony(dot)caduto(at)amsoftwaredesign(dot)com>
Subject: Re: numeric data type?
Date: 2006-01-22 09:54:19
Message-ID: 001d01c61f39$d18db5c0$11291dc3@zlatkovyfkpgz6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)caduto(at)amsoftwaredesign(dot)com>
To: "Zlatko Matić" <zlatko(dot)matic1(at)sb(dot)t-com(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message frank church 2006-01-22 12:53:57 Working out diskspace taken by database and tables 7.4
Previous Message Tino Wildenhain 2006-01-22 08:26:27 Re: PostgreSQL Top 10 Wishlist