| From: | Raimon Fernandez <coder(at)montx(dot)com> | 
|---|---|
| To: | PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org> | 
| Subject: | numeric definition advice | 
| Date: | 2008-03-07 10:40:55 | 
| Message-ID: | 9EF315C0-3AD5-46AE-BE36-12404ADC24BD@montx.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2008-03-07 13:37:30 | Re: numeric definition advice | 
| Previous Message | Tom Lane | 2008-03-06 17:24:10 | Re: use SSL TO AUTH |