From: | "David Johnston" <polobo(at)yahoo(dot)com> |
---|---|
To: | 'Grzegorz Jaśkiewicz' <gryzman(at)gmail(dot)com>, <condor(at)stz-bg(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Real type with zero |
Date: | 2011-06-29 15:50:32 |
Message-ID: | 008c01cc3674$480cb3c0$d8261b40$@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Grzegorz Jaskiewicz
Sent: Wednesday, June 29, 2011 7:44 AM
To: condor(at)stz-bg(dot)com
Cc: pgsql-general(at)postgresql(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2011-06-29 15:58:20 | Re: point types in "DISTINCT" queries |
Previous Message | Jonathan S. Katz | 2011-06-29 15:37:24 | Re: point types in "DISTINCT" queries |