Search Postgresql Archives

Re: Real type with zero

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

 



-----Original Message-----
From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Grzegorz Jaskiewicz
Sent: Wednesday, June 29, 2011 7:44 AM
To: condor@xxxxxxxxxx
Cc: pgsql-general@xxxxxxxxxxxxxx
Subject: Re:  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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[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