-----Original Message-----
From: pgsql-general-ow...@postgresql.org 
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Grzegorz Jaskiewicz
Sent: Wednesday, June 29, 2011 7:44 AM
To: con...@stz-bg.com
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Real type with zero

what you probably looking for is formatting the output into a string.
Postgresql will store it as 2.3, because that is what 2.30 is anyway.
Its up to you to format it before passing it on to the user/business 
logic/whatever.



I presume (and even if not) the OP is looking to keep the known precision of 
the value.  If I look at 2.3 I do not know whether I have precision of 
measurement only to the tenths or whether I had higher precision but all 
positions beyond the tenths are zero.

Aside from storing the "true" precision in a separate integer field what 
solution is there is this situation.  I guess defining "numeric(S,P)" works 
although I haven't done much actual work with "precision" in the database and 
so I do not know whether it is truly sufficient.  I would guess not since there 
may be cases where the known precision is less than the defined precision and 
so the numeric(S,P) data type will over specify the precision in those cases.

This is beginning to sound like a varchar(n) versus text argument...

David J.



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to