numeric definition advice - Mailing list pgsql-novice

From Raimon Fernandez
Subject numeric definition advice
Date
Msg-id 9EF315C0-3AD5-46AE-BE36-12404ADC24BD@montx.com
Whole thread Raw
In response to Explain explained  ("Markus Stocker" <markus@wilabs.ch>)
Responses Re: numeric definition advice
List pgsql-novice
Hello,


I'm converting a database from SQLite to PostgreSQL, and I would like
to have some punctuatioons about the numeric type.

I want to store monetary values, they need to have decimals, of
course, and most of times a precission of 2.

I see that Postgre has a Monetary type, but in some places I read it's
better to stay with numeric type.

So, in Numeric, we can specify how many decimals (scale) and the
precision.

What happens if I only know how many decimals I want to store, and
have no limit on the precision ?

Is valid to have a numeric with no precision and a scale of 2 ?

I'm plyaing a little and sometimes postgreSQL doesn't allow to change
the precission of the defined fields.

And I can do this and latter change it ?

CREATE DOMAIN currency
   AS numeric(10,2);


So, maybe sometimes I 'll need to have numbers greater than 8 digits
(10-2=8) ?

Also I read that the memory requeriments increase as more digits I
declare ...

I'm worrying for nothing ?


thanks,


raimon


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: use SSL TO AUTH
Next
From: Tom Lane
Date:
Subject: Re: numeric definition advice